On Tue, 31 Jul 2001, raptor wrote:

> Anybody know if exist some module how CGI::Out for buffering output in CGI
> script ?
>
> ]- The other approach if  U don't want to append to var...then U can do
> something like this :
>
> my $buffer;
> sub xprint { $buffer .= @_ };

> possibly U will want to move this code into separate module...!!

probably it's worth explaining why:
http://perl.apache.org/guide/porting.html#Exposing_Apache_Registry_secret

or just use a global.

use vars qw(@buffer);
@buffer = ();  # init
sub xprint { push @buffer, @_  };
...
# flush
print @buffer;

> then use xprint instead of print... and on the end of the script just :
>
> print $buffer;
>
> I also often direct all my output like errors,debug messages etc... trought
> similar function... this aproach is also very useful 'cause if for example
> want later to switch to other envoirment u need to correct just one function
> or if U use Template system...
>
> HtH
> =====
> iVAN
> [EMAIL PROTECTED]
> =====
>
>



_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Reply via email to