From: ndparker <> Date: Thu, 29 Mar 2001 23:33:59 +0000 (+0000) Subject: after installing apache 1.3.19 (win) i had to patch the BEGIN-Blocks (to get the... X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/e2e7aa7684b1d7b5c6824e04b4fd5368720817d0?ds=sidebyside after installing apache 1.3.19 (win) i had to patch the BEGIN-Blocks (to get the script location) --- diff --git a/selfforum-cgi/shared/Template.pm b/selfforum-cgi/shared/Template.pm index 74626d9..d029493 100644 --- a/selfforum-cgi/shared/Template.pm +++ b/selfforum-cgi/shared/Template.pm @@ -12,6 +12,7 @@ use strict; package Template; +use CGI::Carp qw(croak); use XML::DOM; # ==================================================== @@ -63,7 +64,7 @@ sub file { sub insert { my $self=shift; - die "no template file specified" unless (defined $self -> {file}); + croak "no template file specified" unless (defined $self -> {file}); my $name=shift; @@ -81,7 +82,7 @@ sub list { my $self=shift; my $name=shift; - die "no template file specified" unless (defined $self->{file}); + croak "no template file specified" unless (defined $self->{file}); my $list = join '', map { ${ $self -> scrap ($name, $_) } } @{ +shift }; @@ -99,7 +100,7 @@ sub scrap { my $self=shift; my $name=shift; - die "no template file specified" unless (defined $self->{file}); + croak "no template file specified" unless (defined $self->{file}); my %params; @@ -147,15 +148,15 @@ sub parse_file { $self -> {metaon} = $template -> getAttribute ('metaon'); $self -> {metaoff} = $template -> getAttribute ('metaoff'); - die "missing meta defintion(s) in template file '$filename'." unless ($self -> {metaon} and $self -> {metaoff}); + croak "missing meta defintion(s) in template file '$filename'." unless ($self -> {metaon} and $self -> {metaoff}); $self -> {parsed} = {}; foreach ($template -> getElementsByTagName ('Scrap', 0)) { my $name = $_ -> getAttribute ('id'); - die "Element 'Scrap' requires attribute 'id' in template file '$filename'." unless (length ($name)); - die "double defined id '$name' in template file '$filename'." if (exists ($self -> {parsed} -> {$name})); - die "use '/^[_a-zA-Z]\\S*\$/' for 'Scrap'-ids in template file '$filename' (wrong: '$name')." unless ($name =~ /^[_a-zA-Z]\S*$/); + croak "Element 'Scrap' requires attribute 'id' in template file '$filename'." unless (length ($name)); + croak "double defined id '$name' in template file '$filename'." if (exists ($self -> {parsed} -> {$name})); + croak "use '/^[_a-zA-Z]\\S*\$/' for 'Scrap'-ids in template file '$filename' (wrong: '$name')." unless ($name =~ /^[_a-zA-Z]\S*$/); $self -> {parsed} -> {$name} = $_ -> getFirstChild -> getData; $self -> {parsed} -> {$name} =~ s/^\s+|\s+$//g;} diff --git a/selfforum-cgi/user/fo_posting.pl b/selfforum-cgi/user/fo_posting.pl index 91a21a1..9bc7eb0 100644 --- a/selfforum-cgi/user/fo_posting.pl +++ b/selfforum-cgi/user/fo_posting.pl @@ -14,9 +14,11 @@ use strict; use vars qw($Bin $Shared $Script %subhash $httpurl $flocked); BEGIN { - ($Bin) = ($0 =~ /^(.*)\/.*$/)? $1 : '.'; + my $null = $0; $null =~ s/\\/\//g; # for win :-( + ($Bin) = ($null =~ /^(.*)\/.*$/)? $1 : '.'; $Shared = "$Bin/../shared"; - ($Script) = ($0 =~ /^.*\/(.*)$/)? $1 : $0;} + ($Script) = ($null =~ /^.*\/(.*)$/)? $1 : $null; +} use CGI::Carp qw(fatalsToBrowser); diff --git a/selfforum-cgi/user/fo_view.pl b/selfforum-cgi/user/fo_view.pl index c6b21cd..0aefde4 100644 --- a/selfforum-cgi/user/fo_view.pl +++ b/selfforum-cgi/user/fo_view.pl @@ -2,12 +2,14 @@ use strict; -use vars qw($Bin $Shared $Script $t0); +use vars qw($Bin $Shared $Script); BEGIN { - ($Bin) = ($0 =~ /^(.*)\/.*$/)? $1 : '.'; + my $null = $0; $null =~ s/\\/\//g; # for win :-( + ($Bin) = ($null =~ /^(.*)\/.*$/)? $1 : '.'; $Shared = "$Bin/../shared"; - ($Script) = ($0 =~ /^.*\/(.*)$/)? $1 : $0;} + ($Script) = ($null =~ /^.*\/(.*)$/)? $1 : $null; +} use lib "$Shared"; use CGI::Carp qw(fatalsToBrowser);