Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: existing PERL modules?

by strat (Canon)
on Apr 17, 2005 at 09:20 UTC ( [id://448609]=note: print w/replies, xml ) Need Help??


in reply to existing PERL modules?

Well, you could filter the files in the subdirectories in @INC with the extension .pm...
use File::Find; foreach my $dir (@INC) { find( sub { if (-f $_ and /\.pm/) { my $module = $File::Find::name; $module =~ s|\Q$dir\E/||; # remove part of @INC $module =~ s|\.pm$||; # remove extension .pm $module =~ s|/|::|g; # translate / to :: print "$module\n"; } # if }, $dir); } # foreach

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Replies are listed 'Best First'.
Re^2: existing PERL modules?
by MarkusLaker (Beadle) on Apr 17, 2005 at 12:00 UTC
    In similar vein, I've found this little program surprisingly useful:

    [~]$ cat `which pmwhich` #!/usr/bin/perl use warnings; use strict; die "pmwhich module-name\n" unless @ARGV == 1; my $module = $ARGV[0]; $module =~ s!::!/!g; for my $dir (@INC) { my $fqn = "$dir/$module.pm"; if (-e $fqn) { print $fqn, "\n"; last; } } [~]$ pmwhich bigint /usr/lib/perl5/5.8.5/bigint.pm [~]$
    It's a quick way to find out whether a particular module is installed -- and it helps me learn the tricks other module-writers have used. Shoulders of giants, y'know?

    Markus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://448609]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-20 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found