Tatsuhiko Miyagawa wrote:
> The following HTML-Template filter code works (becomes useful with
> PerlOptions +SetupEnv)
>   
>   package Slasher::HTMLTemplate;
>   
>   use strict;
>   
>   use Apache::RequestRec ();
>   use Apache::RequestIO ();
>   use Apache::Filter ();
>   use HTML::Template;
>   
>   use Apache::Const -compile => 'OK';
>   
>   sub handler {
>       my $filter = shift;
>       my $r = Apache->request;
>       while ($filter->read(my $buffer)) {
>           my $t = HTML::Template->new(scalarref => \$buffer,
>                                       die_on_bad_params => 0);
>           $t->param(%ENV);
>           $filter->print($t->output);
>       }
>       return Apache::OK;
>   }
>   
>   1;
>  
> But when I change while loop to accumulate read() input to a scalar
> variable, it doesn't work (it doesn't print out anything)
> 
>       my $html;
>       while ($filter->read(my $buffer, 1024)) {
>           $html .= $buffer;
>       }
>       my $t = HTML::Template->new(scalarref => \$html,
>                                   die_on_bad_params => 0);
>       $t->param(%ENV);
>       $filter->print($t->output);
> 
> In a word, Apache::Filter::print() doesn't work outside the read()
> loop. Any pointer for it?

It did work for me when I've tried more evolved reverse filter (posted 
here a few weeks ago). Care to provide a simple example that doesn't 
work for you? without involving HTML::Filter

can you simply do:

$filter->print("whatever");

?


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to