]> git.p6c8.net - selfforum.git/blobdiff - selfforum-cgi/shared/Conf/Admin.pm
modified version check
[selfforum.git] / selfforum-cgi / shared / Conf / Admin.pm
index 5d077369a9abc6953bd85444ad8d647be52cf7ab..ac0d8dc3ab27c7c89df85dfa4c4e310f792f87bd 100644 (file)
@@ -4,7 +4,7 @@ package Conf::Admin;
 #                                                                              #
 # File:        shared/CheckRFC.pm                                              #
 #                                                                              #
 #                                                                              #
 # File:        shared/CheckRFC.pm                                              #
 #                                                                              #
-# Authors:     Andre Malo       <nd@o3media.de>, 2001-06-16                    #
+# Authors:     André Malo <nd@o3media.de>                                      #
 #                                                                              #
 # Description: read and parse admin default config                             #
 #                                                                              #
 #                                                                              #
 # Description: read and parse admin default config                             #
 #                                                                              #
@@ -13,10 +13,9 @@ package Conf::Admin;
 use strict;
 use vars qw(
   @EXPORT
 use strict;
 use vars qw(
   @EXPORT
-  $VERSION
 );
 
 );
 
-use Lock qw(:READ);
+use Lock;
 
 use XML::DOM;
 
 
 use XML::DOM;
 
@@ -24,7 +23,11 @@ use XML::DOM;
 #
 # Version check
 #
 #
 # Version check
 #
-$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+# last modified:
+#    $Date$ (GMT)
+# by $Author$
+#
+sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
 
 ################################################################################
 #
 
 ################################################################################
 #
@@ -93,9 +96,10 @@ sub read_admin_conf ($) {
   my %conf;
 
   if (-f $filename) {
   my %conf;
 
   if (-f $filename) {
-    if (lock_file ($filename)) {
-      my $xml = new XML::DOM::Parser -> parsefile ($filename);
-      violent_unlock_file ($filename) unless (unlock_file ($filename));
+    my $admin = new Lock ($filename);
+    if ($admin -> lock(LH_SHARED)) {
+      my $xml = new XML::DOM::Parser -> parsefile ($admin -> filename);
+      $admin -> unlock;
 
       # write data into the hash
       #
 
       # write data into the hash
       #
@@ -198,10 +202,6 @@ sub read_admin_conf ($) {
           -> getFirstChild -> getData
       };
     }
           -> getFirstChild -> getData
       };
     }
-
-    else {
-      violent_unlock_file ($filename);
-    }
   }
 
   # return
   }
 
   # return
@@ -213,4 +213,4 @@ sub read_admin_conf ($) {
 
 #
 #
 
 #
 #
-### end of Conf::Admin #########################################################
+### end of Conf::Admin #########################################################
\ No newline at end of file

patrick-canterino.de