X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/e4453d784ec8903820ff2e03c29545b13060f060..1e5e0364f9fc5f0a3dbac69f9affbb3931115a58:/selfforum-cgi/shared/Template.pm diff --git a/selfforum-cgi/shared/Template.pm b/selfforum-cgi/shared/Template.pm index 50103d2..0400ec7 100644 --- a/selfforum-cgi/shared/Template.pm +++ b/selfforum-cgi/shared/Template.pm @@ -4,8 +4,8 @@ package Template; # # # File: shared/Template.pm # # # -# Authors: André Malo , 2001-07-01 # -# Frank Schoenmann , 2001-06-04 # +# Authors: André Malo # +# Frank Schönmann # # # # Description: Handle XML based HTML-Templates # # # @@ -14,13 +14,9 @@ package Template; use strict; use vars qw( $xml_dom_used - $VERSION ); -use Carp qw( - croak - confess -); +use Carp qw(croak); BEGIN { $xml_dom_used = eval q[ @@ -34,7 +30,11 @@ BEGIN { # # 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'} ### sub new #################################################################### @@ -107,30 +107,13 @@ sub insert { # sub list { my $self = shift; + my $name = shift; croak "no template file specified" unless (defined $self -> {file}); - $self -> joinlist ('' => @_); -} - -### sub joinlist ############################################################### -# -# fill in a complete list, using a scrap between the list elements -# -# Params: $join - joining string (or stringref) -# $name - name of the atomic list scrap -# $array - list of hashes (same strcuture like the hash used by 'scrap') -# -# Return: scalar reference - filled in list -# -sub joinlist { - my $self = shift; - my $join = shift; - $join = $$join if ref($join); - my $name = shift; - - my $list = join $join => map { ${ $self -> scrap ($name, $_) } } @{ +shift }; +# no warnings 'uninitialized'; + my $list = join '' => map { ${ $self -> scrap ($name, $_) } } @{ +shift }; # return \$list; @@ -215,42 +198,6 @@ sub scrap { \$scrap; } -### printscrap () ############################################################## -# -# fill in a template scrap and print to STDOUT -# -# Params: $name name of the scrap -# ... -# $no_nl 1 - remove newlines (\n) -# 0 - do no such thing -# -# Return: success code (boolean) -# -sub printscrap { - my $self = shift; - - $self -> scrap2file (\*STDOUT, @_); -} - -### scrap2file () ############################################################## -# -# fill in a template scrap and print to a file handle -# -# Params: $handle filehandle -# $name name of the scrap -# ... -# $no_nl 1 - remove newlines (\n) -# 0 - do no such thing -# -# Return: success code (boolean) -# -sub scrap2file { - my $self = shift; - my $handle = shift; - - print $handle ${$self->scrap(@_)}; -} - ### sub parse_file ############################################################# # # read in and parse template file