Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Find installed Perl modules matching a regular expression

by toolic (Chancellor)
on Sep 22, 2009 at 20:55 UTC ( #796824=note: print w/ replies, xml ) Need Help??


in reply to Find installed Perl modules matching a regular expression

I have updated the code to be more portable to other operating systems. The restriction now is that the initialization file is only supported for Unix-type operating systems. But, even that could be fixed by changing a single line in the source code.


Comment on Re: Find installed Perl modules matching a regular expression
Re^2: Find installed Perl modules matching a regular expression
by Anonymous Monk on Sep 25, 2009 at 21:58 UTC
    Here is another idea, I would replace
    if (-M $init_file > $days) { $message = "Warning: $init_file is older than $days day\n"
    with a check to see if $init_file is more recently modified than a directory in @INC, like
    for my $init_file ( '.', '..' ) { my $mod = ( stat $init_file )[9]; if ( my @mod = grep { ( stat $_ )[9] > $mod } @INC ) { warn "Warning: $init_file is older than (", join( ' , ', @mod +), ") "; } } __END__ Warning: .. is older than (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-thr +ead , C:/perl/site/5.10.1/lib , .) at - line 4.
      Nice idea. However, it does not seem to work if a sub-directory of a directory in @INC has been modified. Since directories under @INC can be arbitrarily deep, it would be necessary to perform a find on all directories, which is what the init file was designed to avoid.

      Perhaps there is a more efficient way to check if any directory has been modified throughout a tree.

        it would be necessary to perform a find on all directories

        I don't think that is neccessary. perllocal.pod lives in @INC, and when you install modules (with ExtUtils::MakeMaker), perllocal.pod gets updated, and the directory mtime gets updated.

        Since Module::Build doesn't update perllocal (yet), and neither do ppm or apt-get..., after installing a module an admin might touch @INC

        $atime = $mtime = time; utime $atime, $mtime, @INC;

        Additional directories to check might be

        perl -V:installbin -V:installscript -V:installsitebin

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-10-01 22:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (40 votes), past polls