Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re-runnably editing a file in place

by broquaint (Abbot)
on May 22, 2003 at 09:47 UTC ( [id://260013]=note: print w/replies, xml ) Need Help??


in reply to Re-runnably editing a file in place

Sounds like you want transactions for your files, and rather conveniently, this is just what File::Transaction provides e.g
use File::Transaction; my $ft = File::Transaction->new; $ft->linewise_rewrite($fname); ## do stuff if($file_contents_changed) { $ft->commit } else { $ft->revert }
See. the File::Transaction docs for more info.
HTH

_________
broquaint

Log In?
Username:
Password:

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

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

    No recent polls found