You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeff Pang <je...@mail.ru> on 2012/08/08 08:42:40 UTC
development state of MP
I have not used modperl for long days. Is Apache mod_perl in actively
development recently? or just in maintenance state?
Thank you.
Re: Configuring mod-Perl to handle only some file types
Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 8/8/2012 2:13 PM, jniederberger@comcast.net wrote:
> Hello,
>
> I have a mod_perl program that is written to handle URL's that
> name either a directory or *.html type files. All other types
> I want Apache to just do its regular thing (e.g., serve image
> type files, or .doc, .pdf, .js, .css, etc.)
> What's a good way to configure that? So for an entire website
> directory, and all its substructure, my perl handler gets only
> directories
> or *.html files, and apache handles everything else without
> involing my perl handler.
>
> Thanks for any help or ideas.
Hi Joe,
I used .cgim extension for this to reflect mod_perl
I don't have access to an example from a more recent server but this is
how I made .cgim's under one site work. It might help you.
<Directory /htdocs/example.org/html/>
<Files ~ "\.cgim$">
SetHandler perl-script
PerlHandler Apache::PerlRun
#PerlHandler Apache::Registry
Options +ExecCGI
PerlSendHeader On
PerlInitHandler Apache::StatINC
PerlSetVar StatINC_Debug 1
</Files>
</Directory>
regards,
KAM
Re: Configuring mod-Perl to handle only some file types
Posted by "Ekki Plicht (DF4OR)" <ek...@plicht.de>.
On Wed, Aug 8, 2012 at 9:30 PM, <jn...@comcast.net> wrote:
> Thank you – both Kevin and Ekki
>
> For my purposes I think Ekki’s idea sounds more like it could work.
>
> Ekki – would you know how to phrase that match in the negative?
> In other words, write a regex to match .jpeg, .doc, ....etc. etc.
> and if those matches FAIL - then use perl handler?
>
Joe,
I don't think that that approach will work in the long term. What if
someone wants to serve a file *.xyz in the future? You would have to
adjust that regex. And again, and again...
I think it would be much easier to set up <DirectoryMatch 'regex'> and
<FilesMatch 'regex'> sections for what you want to serve by your
handler(s), and let Apache handle _all_ other files/dirs.
Filter on what is the smaller set - and I think that's your dirs and .html
files. All other files not mentioned in those <*Match ...> sections are
automatically handled by Apache. Further - a regex matching all those files
you don't want to handle yourself would be rather lengthy and unwieldy.
Take a look at Apaches fine documentation, look for <DirectoryMatch ...>
and <FilesMatch ...> directives.
http://httpd.apache.org/docs/2.2/mod/core.html#directorymatch
http://httpd.apache.org/docs/2.2/mod/core.html#filesmatch
For example, a <FilesMatch ...> for . htm or .html Files would look like
(untested):
PerlRequire /var/www/mysite/cgi-bin/my_modperl_module.pm
<FilesMatch "\.html?$">
SetHandler perl-script
PerlResponseHandler my_modperl_module # which contains a sub
handler {...};
</FilesMatch>
Cheers,
Ekki
>
>
>
>
> *From:* Ekki Plicht (DF4OR) <ek...@plicht.de>
> *Sent:* Wednesday, August 08, 2012 2:23 PM
> *To:* mod_perl list <mo...@perl.apache.org>
> *Subject:* Re: Configuring mod-Perl to handle only some file types
>
>
>
> On Wed, Aug 8, 2012 at 8:13 PM, <jn...@comcast.net> wrote:
>
>> Hello,
>>
>> I have a mod_perl program that is written to handle URL's that
>> name either a directory or *.html type files. All other types
>> I want Apache to just do its regular thing (e.g., serve image
>> type files, or .doc, .pdf, .js, .css, etc.)
>> What's a good way to configure that? So for an entire website directory,
>> and all its substructure, my perl handler gets only directories
>> or *.html files, and apache handles everything else without
>> involing my perl handler.
>>
>>
>>
> I just used a <FilesMatch> section in httpd.conf. Like so:
> <FilesMatch "\.(tx|html\...)$">
> SetHandler perl-script
> PerlResponseHandler TxShow
> </FilesMatch>
>
> This match expression filters out any files that either end in .html.?? or
> .tx.??, the two ?? being language extensions used for auto negotiation.
>
> You can build nearly any kind of Regex there to filter out what you want
> handled by your mod_perl script and what should be handled by Apache
> directly.
>
> Cheers,
> Ekki
>
>
>
Re: Configuring mod-Perl to handle only some file types
Posted by jn...@comcast.net.
Thank you – both Kevin and Ekki
For my purposes I think Ekki’s idea sounds more like it could work.
Ekki – would you know how to phrase that match in the negative?
In other words, write a regex to match .jpeg, .doc, ....etc. etc.
and if those matches FAIL - then use perl handler?
Thanks again,
Joe N
From: Ekki Plicht (DF4OR)
Sent: Wednesday, August 08, 2012 2:23 PM
To: mod_perl list
Subject: Re: Configuring mod-Perl to handle only some file types
On Wed, Aug 8, 2012 at 8:13 PM, <jn...@comcast.net> wrote:
Hello,
I have a mod_perl program that is written to handle URL's that
name either a directory or *.html type files. All other types
I want Apache to just do its regular thing (e.g., serve image
type files, or .doc, .pdf, .js, .css, etc.)
What's a good way to configure that? So for an entire website directory, and all its substructure, my perl handler gets only directories
or *.html files, and apache handles everything else without
involing my perl handler.
I just used a <FilesMatch> section in httpd.conf. Like so:
<FilesMatch "\.(tx|html\...)$">
SetHandler perl-script
PerlResponseHandler TxShow
</FilesMatch>
This match expression filters out any files that either end in .html.?? or .tx.??, the two ?? being language extensions used for auto negotiation.
You can build nearly any kind of Regex there to filter out what you want handled by your mod_perl script and what should be handled by Apache directly.
Cheers,
Ekki
Re: Configuring mod-Perl to handle only some file types
Posted by "Ekki Plicht (DF4OR)" <ek...@plicht.de>.
On Wed, Aug 8, 2012 at 8:13 PM, <jn...@comcast.net> wrote:
> Hello,
>
> I have a mod_perl program that is written to handle URL's that
> name either a directory or *.html type files. All other types
> I want Apache to just do its regular thing (e.g., serve image
> type files, or .doc, .pdf, .js, .css, etc.)
> What's a good way to configure that? So for an entire website directory,
> and all its substructure, my perl handler gets only directories
> or *.html files, and apache handles everything else without
> involing my perl handler.
>
>
>
I just used a <FilesMatch> section in httpd.conf. Like so:
<FilesMatch "\.(tx|html\...)$">
SetHandler perl-script
PerlResponseHandler TxShow
</FilesMatch>
This match expression filters out any files that either end in .html.?? or
.tx.??, the two ?? being language extensions used for auto negotiation.
You can build nearly any kind of Regex there to filter out what you want
handled by your mod_perl script and what should be handled by Apache
directly.
Cheers,
Ekki
Configuring mod-Perl to handle only some file types
Posted by jn...@comcast.net.
Hello,
I have a mod_perl program that is written to handle URL's that
name either a directory or *.html type files. All other types
I want Apache to just do its regular thing (e.g., serve image
type files, or .doc, .pdf, .js, .css, etc.)
What's a good way to configure that? So for an entire website
directory, and all its substructure, my perl handler gets only directories
or *.html files, and apache handles everything else without
involing my perl handler.
Thanks for any help or ideas.
Joe N
Re: development state of MP
Posted by Fred Moyer <fr...@redhotpenguin.com>.
On Wed, Aug 8, 2012 at 10:30 AM, Randolf Richardson <ra...@modperl.pl> wrote:
>> I have not used modperl for long days. Is Apache mod_perl in actively
>> development recently? or just in maintenance state?
>
> It seems to me that it's quite active as a lot of people have been
> discussing some aspects of its code.
Yes, we've had 2 mod_perl core releases so far in 2012, and another
one is expected soon. While not a lot of new features are being added,
we've been keeping up with the newer Perl and Apache versions. Since
mod_perl exposes the Apache API, the development follows suit there in
terms of features.
>
> The thing that's improtant to remember about ModPerl is that it's
> very well written, most likely because it's well thought out, and so
> it doesn't seem to need a lot of changes.
>
> Where most of the activity will occur, I've noticed, is within the
> various CPAN modules that provide specific functionality. ModPerl is
> more of a facilitator to integrate Perl into Apache and APR, and make
> it persistent (which has the wonderful side-effect of major
> performance gains).
>
>> Thank you.
>
> Randolf Richardson - randolf@inter-corporate.com
> Inter-Corporate Computer & Network Services, Inc.
> Beautiful British Columbia, Canada
> http://www.inter-corporate.com/
>
>
Re: development state of MP
Posted by Randolf Richardson <ra...@modperl.pl>.
> I have not used modperl for long days. Is Apache mod_perl in actively
> development recently? or just in maintenance state?
It seems to me that it's quite active as a lot of people have been
discussing some aspects of its code.
The thing that's improtant to remember about ModPerl is that it's
very well written, most likely because it's well thought out, and so
it doesn't seem to need a lot of changes.
Where most of the activity will occur, I've noticed, is within the
various CPAN modules that provide specific functionality. ModPerl is
more of a facilitator to integrate Perl into Apache and APR, and make
it persistent (which has the wonderful side-effect of major
performance gains).
> Thank you.
Randolf Richardson - randolf@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/