#!/usr/bin/perl #!D:/Server/Perl/bin/perl.exe -w package main; BEGIN { use strict; use CGI::Carp qw(carpout fatalsToBrowser); # use CGI qw(:standard escapeHTML); # use CGI::Cookie; use CGI; require "../file/file_lock.pm"; require "../html/body.pm"; require "../time/time.pm"; require "bookstore_config.pm"; require "bookstore_classes.pm"; } my @aData; # File exists and isn't empty if ( -e $FILE and -s $FILE ) { open(IN, "< $FILE") or die "Couldn't open file $FILE_REL: $!\n"; &lock(IN); @aData = ; &unlock(IN); close(IN); } else { # Error message print ("Content-type: text/html\n\n"); print ("Couldn't find file $FILE_REL\n"); exit(0); } my $HTML = new CGI; local $booklistLastVisited = $HTML->cookie(-name=>'booklistLastVisited') || time(); my $cookie = $HTML->cookie( -name=>'booklistLastVisited', -value=>time(), -expires=>'+1y', -path => '/'); print $HTML->header(-cookie=>$cookie); # Array of categories local @aCatList = (); # Hash with references to the categories stored in aCatList my %hCatList = {}; my @aTempLine; my $iBookCount = 0; local $changeDate = str2time("2002-01-01"); # Read data # Remove header shift @aData; foreach (@aData) { # Remove new line from array element chomp ($_); # Split string # Type Author Title Publisher EUR ATS Name Link Subtitle Timestamp @aTempLine = split (/$DATA_DEL/, $_); if ($aTempLine[0] eq "cat") { push (@aCatList, Category->new($aTempLine[2], $aTempLine[6], $aTempLine[8], str2time($aTempLine[9]),[])); $hCatList{$aTempLine[6]} = \$aCatList[$#aCatList]; $iBookCount = 0; #print (${$hCatList{$aTempLine[6]}}->get("sTitle"),"
"); } else { # Author, Title, Publisher, EUR, ATS, Name, Link, Subtitle, Timestamp push (@{${$hCatList{$aTempLine[0]}}->get("rBooklist")}, Book->new($aTempLine[1],$aTempLine[2],$aTempLine[3],$aTempLine[4],$aTempLine[5],$aTempLine[6],$aTempLine[7],$aTempLine[8],str2time($aTempLine[9]))); $iBookCount++; #${${$hCatList{$aTempLine[0]}}->get("rBooklist")}[$#{${$hCatList{$aTempLine[0]}}->get("rBooklist")}]->printBook($booklistLastVisited); } if ($changeDate < str2time($aTempLine[9])) { $changeDate = str2time($aTempLine[9]); } } head(); foreach (@aCatList) { body::blockStart($PATH_OFFSET); $_->printCategory($booklistLastVisited); body::blockEnd($PATH_OFFSET); } end(); exit(0); sub head { print < archimedes - Unsere Erfolgsbücherei