Linux cli command IO_AtomicFilepm

➡ A Linux man page (short for manual page) is a form of software documentation found on Linux and Unix-like operating systems. This man-page explains the command IO_AtomicFilepm and provides detailed information about the command IO_AtomicFilepm, system calls, library functions, and other aspects of the system, including usage, options, and examples of _. You can access this man page by typing man followed by the IO_AtomicFilepm.

NAME 🖥️ IO_AtomicFilepm 🖥️

write a file which is updated atomically

SYNOPSIS

use strict; use warnings; use feature say; use IO::AtomicFile; # Write a temp file, and have it install itself when closed: my $fh = IO::AtomicFile->open(“bar.dat”, “w”); $fh->say(“Hello!”); $fh->close || die “couldnt install atomic file: $!”; # Write a temp file, but delete it before it gets installed: my $fh = IO::AtomicFile->open(“bar.dat”, “w”); $fh->say(“Hello!”); $fh->delete; # Write a temp file, but neither install it nor delete it: my $fh = IO::AtomicFile->open(“bar.dat”, “w”); $fh->say(“Hello!”); $fh->detach;

DESCRIPTION

This module is intended for people who need to update files reliably in the face of unexpected program termination.

For example, you generally don’t want to be halfway in the middle of writing /etc/passwd and have your program terminate! Even the act of writing a single scalar to a filehandle is not atomic.

But this module gives you true atomic updates, via rename. When you open a file /foo/bar.dat via this module, you are actually opening a temporary file /foo/bar.dat..TMP, and writing your output there. The act of closing this file (either explicitly via close, or implicitly via the destruction of the object) will cause rename to be called… therefore, from the point of view of the outside world, the file’s contents are updated in a single time quantum.

To ensure that problems do not go undetected, the close method done by the destructor will raise a fatal exception if the rename fails. The explicit close just returns undef.

You can also decide at any point to trash the file you’ve been building.

METHODS

IO::AtomicFile inherits all methods from IO::File and implements the following new ones.

close

$fh->close();

This method calls its parent “close” in IO::File and then renames its temporary file as the original file name.

delete

$fh->delete();

This method calls its parent “close” in IO::File and then deletes the temporary file.

detach

$fh->detach();

This method calls its parent “close” in IO::File. Unlike “delete” in IO::AtomicFile it does not then delete the temporary file.

AUTHOR

Eryq ([email protected]). President, ZeeGee Software Inc (http://www.zeegee.com).

CONTRIBUTORS

Dianne Skoll ([email protected]).

COPYRIGHT & LICENSE

Copyright (c) 1997 Erik (Eryq) Dorfman, ZeeGee Software, Inc. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░