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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Other than the densification I would perform e.g.
sub signature { my ($self) = @_; my @stat = stat $self->{Filename} or die "Couldn't stat '$self->{ +Filename}' : $!"; return $stat[9]; };
=>
sub signature { return -M $_[0]->{Filename} or die "Couldn't stat '$_[0]->{Filena +me}' : $!"; };
It seems like you'd be better off using MTIME as a screen, and then if and only if MTIME is unchanged do further testing. Afterall, a stat is cheaper than a slurp and hash.

As for the name I would think File::Modified might be more appropriate.

UPDATE: Perhaps I should explain the logic behind determining if something is changed. Mtime in and of itself is not complete as one may touch a file node to it's initial setting after editing. Hence we try a different method to check for difference if the Mtime is not changed. If the Mtime is changed, we accept this. Although the inode may have been touched to affect this change, that is acceptable. On the whole this is not such a large performance boost (it only save you a hashing when Mtime is different) but it does (at least to me) present a more comprehensive system.

Also if performance is of concern, or may be for the users, you may consider hashing only a portion of the file. Say the first 32K, or the first and last 16K, etc. since the Digest module reads the entire file into memory with the addfile method.

--
perl -pe "s/\b;([mnst])/'\1/mg"


In reply to Re: File::Dependencies - a new module looking for a good name (and more discussion) by belg4mit
in thread File::Dependencies - a new module looking for a good name (and more discussion) by Corion

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 having a coffee break in the Monastery: (3)
As of 2024-04-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found