On Sat, 8 Sep 2001, raptor wrote:

> | * __DATA__ and __END__ tokens: should read the file till these tokens
> |   are met and compile only the code that has been read so far.
> ]- I'm not aware of the whole process of how Apache::Registry works, but can
> we just do this :
>
> Apache::Registry
> ===========
> ....
> my $sub = $r->slurp_filename;
> $sub =~ s/^(.*?)(__END__|__DATA__)\n.*$/$1/;
> .....

sure, but this is expensive if you don't do that at startup. I'm not sure
if reading line by line util /^(__END__|__DATA)/ is reached would be
faster though. need to benchmark, but even then it'll probably depend on
the size of the source file that gets parsed.

> One more thing about closures instead of :
> .....
> my $eval = join ( '', qq{
>     package $package;
>     use Apache qw(exit);
>     sub handler {
>         $line
>         $sub
>     };
> };
>
>
> use something like this :
>
> my $eval = join ( '', qq{
>     package $package;
>     use Apache qw(exit);
>     $sub
>     sub handler {
>         $line
>         $subname($r);
>    };
> };
>
> just of my head... may have error.. or may don't work at all..

what's $subname? you mean wrapping all the code into a sub and then
calling in? but that's exactly what's handler() doing. It doesn't change
anything, unless I didn't understand your proposal.

_____________________________________________________________________
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/



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

Reply via email to