raptor wrote:
>
> hi,
>
> What I want is access from module to executed-at-the-moment script namespace
> i.e.
>
> the module Utils.pm :
>
> $"abc.asp"::buffer .= 'hello.';
>
> PS. It seems to work only if into the script I'm clearing $Utils::buffer at
> the begining of the script, but this is exactly what I don't want to do...
> want this to be done from outside... code reuse i say :"). It doesn't matter
> too much to me where is the $buffer variable in Utils or in the script
> name-space, I just don't want to clear it out manualy every time in the
> script...
>
It looks like you are using ASP, did you know that $Response->Write()/print()
has its own buffering if you have BufferingOn set ? If you used print()
by itself, then you might have the most flexibility if you are looking
at porting issues.
To answer your question specifically, you can do a
Apache->register_cleanup(sub { $Utils::buffer = '' } );
or the same with ASP $Server->RegisterCleanup()... or
you could do this in ASP global.asa Script_OnStart too,
but you have to do it at some point. You might
also have some function called Utils->init_buffer() which
you could call to do this, and declare buffer as a my()
in Utils so no other package could possibly access it.
-- Josh
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks Founder Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051