]> git.proxmox.com Git - pmg-api.git/commitdiff
add PMG::AtomicFile class
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Feb 2017 08:12:46 +0000 (09:12 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Feb 2017 08:12:46 +0000 (09:12 +0100)
Makefile
PMG/AtomicFile.pm [new file with mode: 0644]

index 54e006dd0956abda1236dc684307d142c6e6095f..81832cfe2a0bb43103693d0d270a7b952bbb29f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,7 @@ LIBSOURCES =                          \
        PMG/HTTPServer.pm               \
        PMG/Ticket.pm                   \
        PMG/AccessControl.pm            \
+       PMG/AtomicFile.pm               \
        PMG/RuleCache.pm                \
        PMG/DBTools.pm                  \
        PMG/RuleDB/Group.pm             \
diff --git a/PMG/AtomicFile.pm b/PMG/AtomicFile.pm
new file mode 100644 (file)
index 0000000..df1cc3c
--- /dev/null
@@ -0,0 +1,20 @@
+package PMG::AtomicFile;
+
+use strict;
+use IO::AtomicFile;
+
+use base qw(IO::AtomicFile);
+
+sub new {
+    my $class = shift;
+    
+    my $self = $class->SUPER::new(@_);
+    
+    return $self;
+}
+
+sub DESTROY {
+    # dont close atomatically (explicit close required to commit changes)
+}
+
+1;