You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by raptor <ra...@unacs.bg> on 2001/07/10 16:02:00 UTC
!!!reevaluating part of the module
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.';
the script xxx.asp :
use Utils;
use vars qw($buffer);
print $buffer
==============
How can I do this. Currently I'm doing something like this :
the module Utils.pm :
(export $buffer)
our $buffered = 1;
our $buffer;
eval qq{ $buffer = '' };
sub _print {
if ($buffered) { $buffer .= $_ for @_ }
else { print $_ for @_ };
};
the script :
use Utils;
print $buffer
but this still doen't clear the buffer betwen different invocation of the
script..
tried also :
eval q{ $buffer = '' };
AND
eval { $buffer = '' };
how can I achieve similar effect .. or I'm doing something wrong
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...
Thanx alot in advance
=====
iVAN
raptor@unacs.bg
=====
Re: PerlSetVar Global on Win32
Posted by Joshua Chamas <jo...@chamas.com>.
"John D. Leonard II" wrote:
>
> All:
>
> In Apache::ASP Version 2.21, I'm can't seem to get any "PerlSetVar Global"
> changes specified in the .htaccess file to take.
>
> 1) I've verified that the .htaccess is being processed,
>
> 2) I've verified that "PerlSetVar IncludesDir" in the .htaccess works fine.
> I can properly $Response->Include a file from a directory specified on the
> IncludesDir path,
>
> 3) the global.asa file in the current directory is being processed ok,
>
This is odd ... to find out what Apache::ASP thinks your Global setting
is, set PerlSetVar Debug -2, and check the error log. One of the last
output lines is the ASP object variables, what's the value of global there?
One thing that I wouldn't be surprised by is if you had some
Global setting somewhere in some *.conf file, or some .htaccess
file above or below the one that you are thinking of that has
the Global setting set to . in conflict with the setting you
are trying to get to work.
I actually do testing on Linux, Solaris & WinNT platforms before
releasing the modules, so if something were really wrong, you
would hope I would pick it up in all of that!
--Josh
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks Founder Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
PerlSetVar Global on Win32
Posted by "John D. Leonard II" <jo...@ce.gatech.edu>.
All:
In Apache::ASP Version 2.21, I'm can't seem to get any "PerlSetVar Global"
changes specified in the .htaccess file to take.
1) I've verified that the .htaccess is being processed,
2) I've verified that "PerlSetVar IncludesDir" in the .htaccess works fine.
I can properly $Response->Include a file from a directory specified on the
IncludesDir path,
3) the global.asa file in the current directory is being processed ok,
4) However, I can't seem to relocate the global.asa using the PerlSetVar
Global command.
I've used this facility AOK under unix, both AIX and Linux. However, under
Win32 it is giving me some grief.
Suggestions? Many thanks,
JL
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: !!!reevaluating part of the module
Posted by Joshua Chamas <jo...@chamas.com>.
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
Re: !!!reevaluating part of the module
Posted by Joshua Chamas <jo...@chamas.com>.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org