Ged Haywood wrote:
Hi Stas,

On Tue, 11 Nov 2003, Stas Bekman wrote:


[snip]
Who would think that a response handler:

print while <FOO>;

would affect the special vars in the filter called by print.


Who indeed!


[snip]
So let's decide how do we act upon this:
[snip]
I'm not sure whether we should make a special case for $_ and localize it behind the scenes. I wonder if someone may find this to be a problem, if they try to use the non-licalized $_ for its side-effects.


Many experienced Perl programmers will use special variables almost
without thinking.  Things like this are frightening, and it's why I'm
sticking to mod_perl 1.x while continuing to read the experiences of
other, more adventurous souls.

I think it's necessary to make mod_perl behave like Perl as far as is
possible.  The chapter on mod_perl traps is big enough already, let's
not let it get any bigger.

mod_perl 2.0 does behave like Perl. It's just silly to say that someone is sticking with mod_perl 1.0 because they are frightened and frightening all the other people :) Frightening other people from using mp2 doesn't make mp2 any better. I think people on this list know pretty well, that if they have a problem we try to solve it right away, so it's not like you are on your own. I see no reason why people should be afraid of trying new things.


If you take your mp1 code and run it on mp2 the discussed issue won't affect you at all. Only if you start using new features and write real filters (which are not available in mod_perl 1.0) you need to be aware that:

print($_);

is really:

print(filter($_));

if you use an output filter, with all the usual pure perl consequences.

For filter writers the advise would be to always localize any special Perl variables before using them. So if you are using a filter from CPAN chances are that it's well written, or if not point the author to the filters chapter which will soonish has this information on, so they can fix it.

__________________________________________________________________
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


-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to