in reply to How To Use Bootstrap Code in Perl Script?
example.tmpl
Then in your perl script you pass the file to the template engine, and populate it with the other content you want on the page:<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1 +, maximum-scale=1"> <link type="text/css" rel="stylesheet" href="../hideo/bootstrap/cs +s/bootstrap.min.css"> <!-- etc. fill in rest of head elements --> </head> <body> <!-- RIGHT AFTER <body> TAG --> <script type="text/javascript" src="../hideo/js-plugin/jquery/jque +ry-1.10.2.min.js"></script> <script type="text/javascript" src="../hideo/JQuery/jquery.cycle.a +ll.2.74.js"></script> <!-- this will be replaced --> <TMPL_VAR NAME=CONTENT> <!-- JUST BEFORE </body> TAG --> <script type="text/javascript" src="../hideo/bootstrap/js/bootstra +p.js"></script> <script type="text/javascript" src="../hideo/js/custom.js"></scrip +t> </body> </html>
use HTML::Template; my $file = '/path/to/example.tmpl'; my $template = HTML::Template->new( filename => $file ); # do all the work to create the content my $content = "Start of Content"; # ... # pass content to the template $template->param( CONTENT => $content ); print "Content-Type: text/html\n\n"; print $template->output;
|
|---|