Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Re: Writing to DATA

by iguanodon (Priest)
on Nov 14, 2003 at 18:14 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found