jm wrote:
i've created a module, part of which creates the beginning of a web
page. the module overall works fine. the sub in question even works
fine, except for one point. here's the sub in the module:
sub html_start
{
my %options = @_;
# $options{title} = page title
my $page_start = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
<head>
<title>$options{title}</title>
<link href=\"/css/style1.css\" rel=\"stylesheet\"
type=\"text/css\" />
</head>
";
return($page_start);
} # end of sub html_start
below is the code fragment calling the sub:
######
my $page_start = &html_start(title => "Privacy");
print "
$page_start
<head>
</head>
.
.
.
</html>
######
notice the additional empty <head> tags.
Noticed.
this works fine and gives
"Privacy" and the page title. removing those tags causes the page
code to be printed out when retrieving the page.
I don't understand that. For me things are printed out only when I use
the print() function.
my question:
why do the <head> tags in the sub work and the page display perfectly
with the additional empty <head> tags, yet only print out the code as
ascii output when i remove the 2nd set of <head> tags?
Consequently, that question is incomprehensible to me.
why are the
<head> tags in the sub not considered legitimate html code when the
<head> structures are identical in both the sub and the main code?
If that is true, you'd better ask W3C. It has nothing to do with Perl.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/