[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl-dev
Subject:    Re: [Patch mp2] #2 PerlSections namespace
From:       Stas Bekman <stas () stason ! org>
Date:       2003-12-15 20:54:57
[Download RAW message or body]

Philippe M. Chiasson wrote:
> On Thu, 2003-12-11 at 15:49, Stas Bekman wrote:
> 
>>Philippe M. Chiasson wrote:
>>
>>>Following this discussion: 
>>>http://marc.theaimsgroup.com/?t=107100040400003&r=1&w=2
>>>
>>>I've made a few adjustements and cleanups.
>>>
>>>The following patch adds ModPerl::Util::file2package() to build a safe
>>>package from a pathname or filename.
>>
>>Do you think we should really expose it in the public API? package2filename is 
>>clear and generic, but file2package does a few assumptions that might not be 
>>suitable to users. Do you think it'll really speed up registry? If not I'd 
>>keep it as an internal util function.
> 
> 
> After some thinking, I've come to agree with your opinion on this one.
> It's easy to expose too many things, and you end up with a big
> commitment to a big API. And in this case, there is so little to gain
> from it.

good ;)

>>>This is in turn used by <Perl> sections to put each block in it's own
>>>namespace. 
>>>
>>>Configuration data placed in Apache::ReadConfig:: directly is processed
>>>after the end of each <Perl> blocks to preserve current behaviour.
>>>Should be marked as deprecated as soon as users can feed their own
>>>configuration to Apache::PerlSections (not possible quite yet)
>>
>>I'd deprecate it for a few releases to let people time to make the transition 
>>and then completely drop the support (at the latest by 2.0 release).
> 
> 
> I'll work up a patch that will warn if Apache::ReadConfig:: is used
> directly. How does that sound?
> 
> "[warn] Direct usage of %Apache::ReadConfig:: is deprecated"
> 
> But for this to be any use, I'd also implement the alternatives to
> add_config() we discussed last week (add_hash, add_namespace, add_glob,
> etc)

+1

>>ayi, why does it look so much simpler in perl:
>>
>>     # Escape everything into valid perl identifiers
>>     $package =~ s/([^A-Za-z0-9_])/sprintf("_%2x", unpack("C", $1))/eg;
>>
>>     # make sure that the sub-package doesn't start with a digit
>>     $package =~ s/^(\d)/_$1/;
> 
> 
> Because perl rocks!
> 
> 
>>can't we mirror this 1:1 with much simpler code?
> 
> 
> Wish we could, but I don't think I'd feel good about calling back into
> perl-land from perldo just for this.

I didn't suggest to eval_pv into perl, just asking whether we can do the above 
in C in the same way?

>>kudos on docs and tests!
> 
> 
> Working up on the next patch, and already checked in the small doc patch
> to ModPerl::Util without filename2package

gozer++

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic