From b3419b3e064483ec301372517e42641f9ebc53a8 Mon Sep 17 00:00:00 2001 From: fox_two <> Date: Mon, 4 Jun 2001 18:49:24 +0000 Subject: [PATCH] scrap(): last parameter (true/false) $no_newlines added; if set, all newlines and line feeds are removed; check this one for bugs... ;) --- selfforum-cgi/shared/Template.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/selfforum-cgi/shared/Template.pm b/selfforum-cgi/shared/Template.pm index 44da2cc..ece7eaa 100644 --- a/selfforum-cgi/shared/Template.pm +++ b/selfforum-cgi/shared/Template.pm @@ -5,6 +5,7 @@ package Template; # File: shared/Template.pm # # # # Authors: André Malo , 2001-04-12 # +# Frank Schoenmann , 2001-06-04 # # # # Description: Handle XML based HTML-Templates # # # @@ -109,7 +110,10 @@ sub list { # # fill in a template scrap # -# Params: $name - name of the scrap +# Params: $name name of the scrap +# ... +# $no_nl 1 - remove newlines (\n) +# 0 - do no such thing # # Return: scalar reference - filled in scrap # @@ -117,6 +121,11 @@ sub scrap { my $self = shift; my $name = shift; + my $no_nl; + if (!ref $_[$#_]) { + $no_nl = pop @_; + } + croak "no template file specified" unless (defined $self -> {file}); @@ -168,6 +177,9 @@ sub scrap { \%params ); + # remove newlines + $scrap =~ s/\n|\r\n|\n\r|\r//g if ($no_nl); + # return \$scrap; } @@ -338,4 +350,4 @@ sub parse_if { # # -### end of Template ############################################################ \ No newline at end of file +### end of Template ############################################################ -- 2.34.1