You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Boysenberry Payne <bo...@habitatlife.com> on 2010/01/13 21:22:29 UTC

Caveats to using Perl Sections for server configuration?

I'm using <Perl> blocks in my apache conf files for early server configuration.
I remember reading someone on this list saying they wouldn't use Perl Sections at all.
The main reason I chose to use them to initialize some of my server configuration was to allow for relative addressing to the .conf file rather than the apache root via the __FILE__ variable.
That allows me to load my perl startup.pl files on different servers regardless of where they're stored by keeping them arranged relative to the .conf file loading them.

Up to now I've kept what I've done in the Perl Sections limited to manipulating @INC and @PerlConfig.
I tried using a couple of perl modules that used 'our' type scopes and they all bombed out saying Perl Sections couldn't add the variable, e.g. it chokes on File::chdir's $CWD variable.
It does seem to use packages correctly, that in turn become available afterword in the symbol tables.

So while the documentation for the Perl Sections was adequate enough to get what I needed accomplished, it's left me hungry for more info on what's going on behind the scenes.

Before I go and dig around in the source (which I plan on doing,) I was wondering if anyone mind sharing the experience and insights on Perl Sections, pros cons, etc.

i.e. I'm referring to <Perl></Perl> blocks in apache .conf files.

Thank you,
Boysenberry Payne


Re: Caveats to using Perl Sections for server configuration?

Posted by Issac Goldstand <ma...@beamartyr.net>.
FWIW, you can look at the source of Apache::UploadMeter to see an
example of <Perl> sections in use - they're actually called during the
httpd.conf parsing triggered by statements found in the httpd.conf

  Issac

Perrin Harkins wrote:
> I don't use them, but in a startup.pl you would be in a different package.
>
> - Perrin
>
> On Wed, Jan 13, 2010 at 8:59 PM, Boysenberry Payne
> <bo...@habitatlife.com> wrote:
>   
>> Do you know if the scope of Perl Sections are the same as when using a startup.pl?
>>
>> -bop
>>
>> On Jan 13, 2010, at 2:15 PM, Perrin Harkins wrote:
>>
>>     
>>> On Wed, Jan 13, 2010 at 3:22 PM, Boysenberry Payne
>>> <bo...@habitatlife.com> wrote:
>>>       
>>>> I'm using <Perl> blocks in my apache conf files for early server configuration.
>>>> I remember reading someone on this list saying they wouldn't use Perl Sections at all.
>>>>         
>>> That might have been me.  I don't like to use them.  I find it simpler
>>> to put all the perl code in a startup.pl.  I also like to generate my
>>> httpd.conf from templates, and this means I can also generate conf
>>> files for non-mod_perl servers, like my proxy.
>>>
>>> - Perrin
>>>       
>>     


Re: Caveats to using Perl Sections for server configuration?

Posted by Perrin Harkins <ph...@gmail.com>.
I don't use them, but in a startup.pl you would be in a different package.

- Perrin

On Wed, Jan 13, 2010 at 8:59 PM, Boysenberry Payne
<bo...@habitatlife.com> wrote:
> Do you know if the scope of Perl Sections are the same as when using a startup.pl?
>
> -bop
>
> On Jan 13, 2010, at 2:15 PM, Perrin Harkins wrote:
>
>> On Wed, Jan 13, 2010 at 3:22 PM, Boysenberry Payne
>> <bo...@habitatlife.com> wrote:
>>> I'm using <Perl> blocks in my apache conf files for early server configuration.
>>> I remember reading someone on this list saying they wouldn't use Perl Sections at all.
>>
>> That might have been me.  I don't like to use them.  I find it simpler
>> to put all the perl code in a startup.pl.  I also like to generate my
>> httpd.conf from templates, and this means I can also generate conf
>> files for non-mod_perl servers, like my proxy.
>>
>> - Perrin
>
>

Re: Caveats to using Perl Sections for server configuration?

Posted by Boysenberry Payne <bo...@habitatlife.com>.
Do you know if the scope of Perl Sections are the same as when using a startup.pl?

-bop

On Jan 13, 2010, at 2:15 PM, Perrin Harkins wrote:

> On Wed, Jan 13, 2010 at 3:22 PM, Boysenberry Payne
> <bo...@habitatlife.com> wrote:
>> I'm using <Perl> blocks in my apache conf files for early server configuration.
>> I remember reading someone on this list saying they wouldn't use Perl Sections at all.
> 
> That might have been me.  I don't like to use them.  I find it simpler
> to put all the perl code in a startup.pl.  I also like to generate my
> httpd.conf from templates, and this means I can also generate conf
> files for non-mod_perl servers, like my proxy.
> 
> - Perrin


Re: Caveats to using Perl Sections for server configuration?

Posted by Perrin Harkins <ph...@gmail.com>.
On Wed, Jan 13, 2010 at 3:22 PM, Boysenberry Payne
<bo...@habitatlife.com> wrote:
> I'm using <Perl> blocks in my apache conf files for early server configuration.
> I remember reading someone on this list saying they wouldn't use Perl Sections at all.

That might have been me.  I don't like to use them.  I find it simpler
to put all the perl code in a startup.pl.  I also like to generate my
httpd.conf from templates, and this means I can also generate conf
files for non-mod_perl servers, like my proxy.

- Perrin