Hiya,
trying to practise clean clode, i tried to separate html from perl code. Therefor i used the html::Template module, which works good so far. But i only can use "template->output()" once, else the page would get printed twice. Any idea how i could update the page, without having duplicate content showing?
not sure how much my code can help, but here a simplified version of the script using the template:
use CGI qw(:standard);
use CGI::Carp 'fatalsToBrowser';
use URI::Escape;
use HTML::Template;
use strict;
use warnings;
my $q = new CGI;
$| = 1;
my $template = HTML::Template->new(filename => "D://...//test.html");
print $q->header();
my $onevariable = $q -> param ("web");
print $template->output(); #displays beautiful css styled headline in
+grid format
use ownModule;
print '<p id = "any" ';
ownModuleMethod(); #by responseBufferLimit="0" updates are getting wr
+itten on the website, which i'd like to keep that way, so the user kn
+ows, which data get processed
print '</p> ';
#now removing all the updates
print <<_EOT_;
<script language=JavaScript type=text/javascript><!--
document.getElementById('any').style.display='none';
//--></script>
_EOT_
my $amount = ownModuleOtherMethod();
$template->param( AMOUNT => $amount); #now i want the results to displ
+ay
$template->output; #can not do that, else it would print the same cont
+ent again
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.