Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: HTML::Template::Pro - Issue with template files larger than 8K

by InfiniteSilence (Curate)
on Jul 08, 2014 at 18:42 UTC ( #1092770=note: print w/replies, xml ) Need Help??


in reply to HTML::Template::Pro - Issue with template files larger than 8K

Doesn't happen to me (Perl v5.10.0; OpenSuse 11.0/Apache 2.2.19; HTML-Template-Pro-0.9510):

#!/usr/bin/perl use strict; use HTML::Template::Pro; my $tmpl = HTML::Template::Pro->new(filename=>'/tmp/blah.html'); print qq|Content-Type: text/html\n\n|; print $tmpl->output(); 1;

Snippet of the file:

<!DOCTYPE html> <span>blah</span><span>blah</span><span>blah</span><span>blah</span><s +pan>blah</spa\ n><span>blah</span><span>blah</span><span>blah</span><span>blah</span> +<span>blah</s\ pan><span>blah</span><span>blah</span><span>blah</span><span>blah</spa +n><span>blah<\ /span><span>blah</span><span>blah</span><span>blah</span>...

File size is:

170017

Has to be something specific to your setup. Does it work when you run it on the command line?

Celebrate Intellectual Diversity

Replies are listed 'Best First'.
Re^2: HTML::Template::Pro - Issue with template files larger than 8K
by Uniden (Initiate) on Jul 08, 2014 at 19:41 UTC

    Yep, thanks, I totally forgot to run from command line. Well, from command line it works just fine.. I upped the size of the template file to about 5MB and no issues with command line. Is that weird or what?!? So I suspect that the issue is rather at the Apache level. I guess I will just reset my httpd.conf and start from there.

      Oki Doki! The culprit is the output buffering. When executing the script via command line, the header does display exactly after 8192 bytes, which when run through Apache produces an error. Output buffering can be disabled in Perl, so I added the line "$|=1;" to my script and now it works.

      #!/usr/bin/perl
      use strict;
      $|=1;
      use HTML::Template::Pro;
      my $tmpl = HTML::Template::Pro -> new(filename => 'test.tmpl');
      print "Content-Type: text/html\n\n";
      $tmpl -> output();

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1092770]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-01-24 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?