]> git.p6c8.net - selfforum.git/blobdiff - selfforum-cgi/shared/Template/Forum.pm
improved the behavior of get_all_threads and create_forum_xml_string
[selfforum.git] / selfforum-cgi / shared / Template / Forum.pm
index 675494127cb13965d625ac463e8bb7a68fdef7fa..f4223f9e9f4af1586ccc968788c63b3a2e1e9952 100644 (file)
@@ -4,7 +4,7 @@ package Template::Forum;
 #                                                                              #
 # File:        shared/Template/Forum.pm                                        #
 #                                                                              #
 #                                                                              #
 # File:        shared/Template/Forum.pm                                        #
 #                                                                              #
-# Authors:     AndrĂ© Malo <nd@o3media.de>, 2001-06-16                          #
+# Authors:     AndrĂ© Malo <nd@o3media.de>                                      #
 #                                                                              #
 # Description: print Forum main file to STDOUT                                 #
 #                                                                              #
 #                                                                              #
 # Description: print Forum main file to STDOUT                                 #
 #                                                                              #
@@ -13,10 +13,9 @@ package Template::Forum;
 use strict;
 use vars qw(
   @EXPORT
 use strict;
 use vars qw(
   @EXPORT
-  $VERSION
 );
 
 );
 
-use Lock qw(:READ);
+use Lock;
 use Encode::Plain; $Encode::Plain::utf8 = 1;
 use Posting::_lib qw(
   get_all_threads
 use Encode::Plain; $Encode::Plain::utf8 = 1;
 use Posting::_lib qw(
   get_all_threads
@@ -30,7 +29,11 @@ use Template::_thread;
 #
 # 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'}
 
 ################################################################################
 #
 
 ################################################################################
 #
@@ -56,10 +59,10 @@ sub print_forum_as_HTML ($$$) {
   my $template = new Template $tempfile;
 
   my ($threads, $stat);
   my $template = new Template $tempfile;
 
   my ($threads, $stat);
+  my $main = new Lock ($mainfile);
 
 
-  unless ($stat = lock_file ($mainfile)) {
-    if (defined $stat) {
-      violent_unlock_file ($mainfile);
+  unless ($main -> lock (LH_SHARED)) {
+    unless ($main -> masterlocked) {
       print ${$template -> scrap (
         $assign -> {errorDoc},
         { $assign -> {errorText} => $template -> insert ($assign -> {'occupied'}) }
       print ${$template -> scrap (
         $assign -> {errorDoc},
         { $assign -> {errorText} => $template -> insert ($assign -> {'occupied'}) }
@@ -81,8 +84,8 @@ sub print_forum_as_HTML ($$$) {
     #
     eval {setpriority 0,0,1};
 
     #
     eval {setpriority 0,0,1};
 
-    $threads = get_all_threads ($mainfile, $param -> {showDeleted}, $view -> {sortedMsg});
-    violent_unlock_file ($mainfile) unless (unlock_file ($mainfile));
+    $threads = get_all_threads ($main -> filename, $param -> {showDeleted}, $view -> {sortedMsg});
+    $main -> unlock;
 
     print ${$template -> scrap (
       $assign -> {mainDocStart},
 
     print ${$template -> scrap (
       $assign -> {mainDocStart},
@@ -105,7 +108,6 @@ sub print_forum_as_HTML ($$$) {
 
     for (@threads) {
       $tpar -> {thread} = "$_";
 
     for (@threads) {
       $tpar -> {thread} = "$_";
-      $|++;
       print ${html_thread ($threads -> {$_}, $template, $tpar)},"\n",'<dd>&nbsp;</dd>',"\n";}
 
     print "</dl>\n",${$template -> scrap ($assign -> {mainDocEnd})};}
       print ${html_thread ($threads -> {$_}, $template, $tpar)},"\n",'<dd>&nbsp;</dd>',"\n";}
 
     print "</dl>\n",${$template -> scrap ($assign -> {mainDocEnd})};}

patrick-canterino.de