use strict;
use warnings;
use CGI qw( header start_html end_html
h1
start_script end_script );
print
header(),
start_html(-title => "I swear to RTFM in the future",
-head => [ start_script({ -type=>'text/javascript',
-src=>'/main1.js' }),
end_script(),
start_script({ -type=>'text/javascript',
-src=>'/main2.js' }),
end_script(),
]
),
h1("Oh, hai! I can haz script?");
print <<"SomeJS";
SomeJS
print end_html();
####
use strict;
use warnings;
use Template;
use CGI qw( header );
my @scripts = qw( main1.js main2.js );
print header();
my $tt2 = Template->new;
$tt2->process(\*DATA,
{ title => "",
script_includes => \@scripts,
script_body => "alert('Oh, noes!');",
})
or warn $tt2->error;
exit 0;
__DATA__
[% title || "I swear to RTFM in the future" %]
[%- FOR script IN script_includes %]
[%- END %]
Oh, hai! I can haz script?