html.pm


#	html.pm
#	Copyright (c) 2004 Jan Henning Thorsen, all rights reserved
#	URL: http://eidolon.flodhest.net E-MAIL: [email protected]
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	package html;
	use strict;
	use cookie;
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sub head {

	### init
	my $cgi = shift;

	### print header
	print cookie::header($cgi);
	print $cgi->start_html(
			-dtd    => 'http://www.w3.org/TR/html4/loose.dtd',
			-title  => $ENV{TITLE},
			-author => $ENV{AUTHOR},
			-meta   => {
				http_equiv => 'Content-Type',
				content    => 'text/html; charset=iso-8859-1',
			},
			-script => [ map {
					(-e "$ENV{JS}/$_.js") ?
						{
							-src      => "$ENV{JS}/$_.js",
							-language => "JavaScript",
							-type     => "text/javascript",
						} : $_;
				} $cgi->param('_script') ],
			-style  => {
				-src => [ map {
						"$ENV{CSS}/$_.css";
					} grep $_, $cgi->param('_style') ],
			},
		);
}
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sub footer {

	### init
	my $cgi = shift;

	### print error
	if($cgi->param('_error')) {
		print q]<script>alert('MESSAGE:\n];
		print join "\\n",map {
				s/\'/\\'/g;
				$_;
			} $cgi->param('_error');
		print q]');</script>];
	}

	### the end
	print $cgi->end_html();
}
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1;