package Template;
+use CGI::Carp qw(croak);
use XML::DOM;
# ====================================================
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;
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 };
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;
$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;}
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);
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);