Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Writing to DATA

by iguanodon (Curate)
on Nov 14, 2003 at 18:14 UTC ( #307138=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Writing to DATA
in thread Writing to DATA

Inline::Files is pretty easy, I use it for exactly what you describe:

use Inline::Files; #... # Get the cached MD5 sum open MD5_SUM or die $!; my $prev_md5_sum = <MD5_SUM>; $prev_md5_sum =~ s!\s*!!sg; close MD5_SUM or die $!; # Get the current MD5 sum open(FH, $file) or die "Can't open '$file': $!"; binmode(FH); my $curr_md5_sum = Digest::MD5->new->addfile(*FH)->hexdigest; close FH; # Quit if this file has changed since the last run die "MD5 sums do not match" unless $curr_md5_sum eq $prev_md5_sum; # Write the new checksum use vars qw($MD5_SUM); open MD5_SUM, ">$MD5_SUM" or die $!; print MD5_SUM $curr_md5_sum; close MD5_SUM or die $!; __END__ maybe have some other stuff here... __MD5_SUM__ f8889c135c8342fc394616c3d34f37c2


Comment on Re: Re: Re: Writing to DATA
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (18)
As of 2015-07-01 17:46 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 (15 votes), past polls