# #
# File: shared/Template.pm #
# #
-# Authors: André Malo <nd@o3media.de>, 2001-04-12 #
+# Authors: André Malo <nd@o3media.de>, 2001-06-16 #
+# Frank Schoenmann <fs@tower.de>, 2001-06-04 #
# #
# Description: Handle XML based HTML-Templates #
# #
################################################################################
use strict;
-use vars qw($xml_dom_used);
+use vars qw(
+ $xml_dom_used
+ $VERSION
+);
-use Carp qw(croak confess);
+use Carp qw(
+ croak
+ confess
+);
BEGIN {
$xml_dom_used = eval q[
];
}
+################################################################################
+#
+# Version check
+#
+$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+
+
### sub new ####################################################################
#
# constructor
#
# 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
#
my $self = shift;
my $name = shift;
+ my $no_nl;
+ if (!ref $_[$#_]) {
+ $no_nl = pop @_;
+ }
+
croak "no template file specified"
unless (defined $self -> {file});
\%params
);
+ # remove newlines
+ #
+ $scrap =~ s/\015\012|\015|\012//g if ($no_nl);
+
# return
\$scrap;
}
return;
}
-# keeping 'require' happy
+# keep 'require' happy
1;
#