Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Find installed Perl modules matching a regular expression

by Anonymous Monk
on Sep 16, 2009 at 12:06 UTC ( #795582=note: print w/ replies, xml ) Need Help??


in reply to Find installed Perl modules matching a regular expression

To get rid of the unix limitation you could die without $ENV{HOME}, or use File::HomeDir.

Here is my caching version, works on ALL systems :)

echo pml is module names list pminst >pml echo pmlf is module filenames list pminst -l >pmlf echo pmlfl is name tabspace filename paste pml pmlf >pmlfl grep "^CGI::S[^:]*$" pml grep "CGI/S[^/]*$" pmlf grep -P "^CGI::S\w+$" pml grep -P "^CGI::S\w+\t" pmlfl perl -lne "print $_ if /^CGI(::\w+)$/" pml perl -lne "print $_ if m!CGI/S[^/]*$!" pmlf perl -lne "print $_ if /^CGI(::\w+)\t/" pmlfl
update: Whoops, I just realized pminst is broken in 2 ways, This doesn't match
D:\>pminst Wx$
And this matches prints MSWin32-x86-multi-thread
D:\>pminst Wx.pm$ Wx MSWin32-x86-multi-thread::Wx D:\>perl -le"print for @INC" C:/perl/5.10.1/lib/MSWin32-x86-multi-thread C:/perl/5.10.1/lib C:/perl/site/5.10.1/lib/MSWin32-x86-multi-thread C:/perl/site/5.10.1/lib .


Comment on Re: Find installed Perl modules matching a regular expression
Select or Download Code
Re^2: Find installed Perl modules matching a regular expression
by toolic (Chancellor) on Sep 16, 2009 at 14:11 UTC
    I appreciate the feedback ++
    To get rid of the unix limitation you could die without $ENV{HOME}, or use File::HomeDir.
    You are correct: the reason for my self-imposed unix limitation is that I was unaware of how to handle $ENV{HOME} in a portable way. Thanks for bringing the File::HomeDir module to my attention. For my purposes, I have come to realize that it is important to only use core modules in this script. The original version of the script used the non-core List::MoreUtils. I ran into problems on one system configuration here @work which, unbelievably, did not have it installed. So I could not even analyze what modules were installed because my script died because it could not use a module!

    I will take a look at the File::HomeDir source code to see if I can incorporate its techniques for making findpm portable.

    Whoops, I just realized pminst is broken in 2 ways
    I am also aware of 2 bugs in pminst:
    1. It completely misses some modules.
    2. It unnecessarily duplicates some modules in its output. I believe this is the same as the MSWin32-x86-multi-thread issue you mentioned. It does not seem to handle all of the @INC paths gracefully. At first, I was willing to concede that my sysadmins set @INC in an unconventional manner... until you mentioned that it was also an issue for your system.

    I should file a bug report on CPAN. Unfortunately, it is not obvious to me how to patch the code. I guess this is the reason I created the findpm script in the first place.

    Update: Someone has reported a bug: https://rt.cpan.org/Public/Bug/Display.html?id=50644

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-09-02 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls