Cool File & Directory Modules IO::AtomicFile 35 of 69 : prev | index | next

IO::AtomicFile

Examples

    use IO::AtomicFile;
    ### Write a temp file, and have it install itself when closed:
    my $FH = IO::AtomicFile->open("bar.dat", "w");
    print $FH "Hello!\n";
    $FH->close || die "couldn't install atomic file: $!";
    ### Write a temp file, but delete it before it gets installed:
    my $FH = IO::AtomicFile->open("bar.dat", "w");
    print $FH "Hello!\n";
    $FH->delete;
    ### Write a temp file, but neither install it nor delete it:
    my $FH = IO::AtomicFile->open("bar.dat", "w");
    print $FH "Hello!\n";
    $FH->detach;

© 2003 Barbie - barbie@missbarbell.co.uk contents http://birmingham.pm.org/