IO::AtomicFile - Online Linux Manual PageSection : 3pm
Updated : 2019-02-28
Source : perl v5.28.1
Note : User Contributed Perl Documentation

NAMEIO::AtomicFile − write a file which is updated atomically

SYNOPSIS​ 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;

DESCRIPTIONThis 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.

AUTHOR

Primary MaintainerDianne Skoll (dfs@roaringpenguin.com).

Original AuthorEryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com).

REVISION$Revision: 1.2 $
0
Johanes Gumabo
Data Size   :   7,333 byte
man-IO::AtomicFile.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   4 / 172,429
Visitor ID   :     :  
Visitor IP   :   3.17.181.181   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|IO::AtomicFile.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|IO::AtomicFile.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|IO::AtomicFile.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|IO::AtomicFile.3pm|43|'br══─}─══ |'br══─}─══ )