Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I plead guilty to whatever XY drift there is in the unrolling specification here, but a proper sailor in high seas will not abandon his complete mystification without reporting it as well as he can, for others with better perspective perchance to hear. It would seem files in the local::lib are not possessed of a,c, or mtime, whilst my crummy modules have all 3. My current best script follows with abridged output.

use strict; use warnings; use 5.014; use File::Find; my @directories_to_search = ( '.', 'C:\Users\Fred\Desktop' ); my @files; find( \&wanted, @directories_to_search ); my @time = localtime; say "local time is @time"; sub wanted { if ( $_ =~ m/.pm$/ ) { my $name = $File::Find::name; my $success = max_acm($name); say "max_acm is $success"; push( @files, $name ); } } sub max_acm { use strict; use 5.014; use warnings; my $path = shift; say "$path is $path"; my @array; push @array, 42; my $atime = ( stat $path )[8]; if ( defined $atime ) { say "atime is ok"; push @array, $atime; } my $ctime = ( stat $path )[10]; if ( defined $ctime ) { say "ctime is ok"; push @array, $ctime; } my $mtime = ( stat $path )[9]; if ( defined $mtime ) { say "mtime is ok"; push @array, $mtime; } my $max = ( sort { $b <=> $a } @array )[0]; return $max; }
max_acm is 42 ./perl5/lib/perl5/Prompt/Timeout.pm is ./perl5/lib/perl5/Prompt/Timeou +t.pm max_acm is 42 ./perl5/lib/perl5/WWW/Mechanize/GZip.pm is ./perl5/lib/perl5/WWW/Mecha +nize/GZip.pm max_acm is 42 C:\Users\Fred\Desktop/alpaca/template_stuff/config1.pm is C:\Users\Fre +d\Desktop/alpaca/template_stuff/config1.pm atime is ok ctime is ok mtime is ok max_acm is 1465162519 C:\Users\Fred\Desktop/alpaca/template_stuff/html1.pm is C:\Users\Fred\ +Desktop/alpaca/template_stuff/html1.pm atime is ok ctime is ok mtime is ok max_acm is 1465162519

The times I'm looking for *in this context* are bounded below by when they become files in this locale. As further indication of XY shift, I would stipulate that it is sufficient to take the max of them, just in order to make useful time comparisons that will work for gilligan's island. I could just as well write a min function, compare it to the max, and have an interesting statistic about age, but first I'm trying to get squared away with the material in the exercises. I'm still *finding* modules, so I have to wonder how perl is interpreting the underlying windows platform. That neither a,c nor m time for the unix installed modules exists knocks my socks off and, along with the sea forward and backslashes, makes me believe that my logic is faulty.

Again, thanks for your comment.


In reply to Re^2: using File::Find to find recently-installed modules by Aldebaran
in thread using File::Find to find recently-installed modules by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found