Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Find installed Perl modules matching a regular expression

by Anonymous Monk
on Sep 25, 2009 at 21:58 UTC ( #797614=note: print w/ replies, xml ) Need Help??


in reply to Re: Find installed Perl modules matching a regular expression
in thread Find installed Perl modules matching a regular expression

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.


Comment on Re^2: Find installed Perl modules matching a regular expression
Select or Download Code
Replies are listed 'Best First'.
Re^3: Find installed Perl modules matching a regular expression
by toolic (Bishop) on Sep 26, 2009 at 00:49 UTC
    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
        Thanks for the explanations. I will investigate these tips further.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-07-29 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls