mod-perl2

Does Devel::Cover work under mod_perl2 on Perl 5.10 for Windows?

The mod_perl2 and Perl 5.10 two are playing nicely together, but I can't seem to find any positive information about Devel::Cover working with mod_perl2 under Win32. I'm currently using ActiveState's Perl 5.10, but I would be open to switching to Strawberry Perl if it meant this combination could work. Also, Devel::Cover PPDs don't see...

How can I access the Apache server configuration in a BEGIN block in mod_perl?

I've been trying to switch from using PerlSetEnv to using custom configuration directives. I have my configuration module with a copy of set_val from the docs: sub set_val { local our ($key, $self, $parms, $arg) = @_; $self->{$key} = $arg; unless ($parms->path) { local our $srv_cfg = Apache2::Module::get_config($se...

Where can I find code profiling and/or code coverage modules that work with mod_perl2?

Is there a way to get this functionality under mod_perl2? And can it be triggered via web requests as opposed to the command line? Or do I need to fake whatever $ENV variables and query strings and cookies that my script requires and use the command line somehow? Google and CPAN searches all seem to point to things that either don't e...

How do I fork properly with mod_perl2?

Hi there. I'm having trouble forking a long-running process from some code running under mod_perl2. Everything works for the most part, but it seems that the forked process is holding open handles to Apache's logfiles - this means Apache won't restart while the process is running (I get a 'failed to open logfiles' message). Here's the...

mod_perl 2 variable and process corruption

We've just ported a fairly large codebase from an ancient Perl 5.005.03 CGI environment to mod_perl 2, and now that it's undergoing a public beta there are a few, possibly related, issues we're encountering from time to time. These build up until we have to restart the server. All of our code compiles under use strict, but has been prev...

Is "local our" the thing to use in object modules under mod_perl2, or only in scripts?

To tailor your scripts toward mp2, avoiding the need for any compatibility wrappers and such, it's said that you're supposed to declare variables using "local our" rather than "my". What about in modules? sub new { local our $type = shift; local our $self = {}; bless $self, $type; } Is that right? Or should it be 'my' so...

Why is my <Perl> section variable only available sometimes under mod_perl?

In httpd.conf I have: <Perl> $MyPackage::foo = { ... }; </Perl> According to the docs, this should, since it's qualified, persist into my perl scripts, which are run with the modperl handler. And sometimes they do. But then all I need to do is touch MyPackage.pm, and all of the sudden $MyPackage::foo is now undef. Restart the we...

How do you debug a mod_perl2 module without restarting?

Environment: Apache/2.2.11 (Win32) mod_apreq2-20051231/2.6.2-dev mod_perl/2.0.4-dev Perl/v5.10.0 Situation very similar to what's described in this discussion list post, except for being on win32. I have this in httpd.conf: PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlSetVar ReloadModules "My...

How do I use mod_perl2 and Apache Bucket Brigades?

I'm writing an application to do proxying and rewriting of webpages on the fly and am pretty settled on using mod_perl2 - there is an existing implementation using mod_perl (v1) that I'm working from. In mod_perl2, there's this idea of APR::Brigades and APR::Buckets which, from my vague understanding, are an efficient way to do the sort...

Safari browser won't display Error 401 page.

I'm using Apache 2 and have a custom 401 page, in httpd.conf ErrorDocument 401 /error/unauthorized.html When I access a protected resource, all browsers show the basic http authentication dialog. If I click "cancel", all browsers but Safari (v3 and v4) will display the custom 401 page. Safari just displays the current page. Is there ...

Is there a mod_perl2/Perl 5 equivalent to PHP's ignore_user_abort()?

I'm writing an internal service that needs to touch a mod_perl2 instance for a long-running-process. The job is fired from a HTTP POST, and them mod_perl handler picks it up and does the work. It could take a long time, and is ready to be handled asynchronously, so I was hoping I could terminate the HTTP connection while it is running....

How does one control the hook order when adding a PerlTransHandler hook?

In apache 2.2 / mod_perl2 I'd like to add a translation phase handler (PerlTransHandler) but have it run after mod_rewrite. In apache 1.3 this was done by controlling module load order. In apache 2.x the hook ordering is more flexible, however mod_perl2 seems to always insert itself first in that hook phase. Looking at the Request Hook...

How do I configure PerlSections in mod_perl2?

I'm trying to use a [PerlSection][1] to get the server name and then use it to configure some RewriteCond-RewriteRule pairs and some other things. It seems I can't get very far. It says you can do this: Apache2->httpd_conf("PerlPassEnv $key $val"); But trying to start Apache I get this syntax error: "Can't locate object method "htt...

Apache2.2 APR load error

The server starts without complaint, but as soon as I hit a page that requires an Apache2 module, like Apache2::Cookie, it dies: Can't load 'C:/Perl5.10/site/lib/auto/APR/Request/Request.dll' for module APR::Request: load_file:The specified module could not be found at C:/Perl5.10/lib/DynaLoader.pm line 202... [etc all the way back to a...

Sending the output of a command-line perl script to the browser via mod_perl

I have a plain perl script that can be run from the command-line via perl -w test.pl. I then have a mod_perl2 script that can be accessed from a web browser. I want to have the latter call the former and send the output to the browser, flushing as it goes. The mp2 script doesn't have a shebang line, because it's mod_perl, so it doesn't ...

mod_perl application having weird intermittent mysql driver issues

At completely random times my mod_perl scripts crash for no discernible reason, here's the error I get: [error] install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted.\nCompilation failed in require at (eval 20) line 3.\n\n at but wait it gets better. Sometimes it's this instead: [error] install_driver(mysql) failed: C...

What Perl RESTful framework do you recommend?

Hi I'm looking for a Perl RESTful framework that have to : work under apache2/mod_perl2 be simple be elegant be light be flexible Am I just dreaming or can I avoid the 'Roll our own' approach? What framework would you recommend? ...

How do I suppress the default apache error document in mod_perl?

I'm developing a RESTful API and I wrote a mod_perl2 handler that takes care of the request. My handler deals with error codes by setting $r->status($http_code) and return $http_code; Everything is fine, except a little problem: when my http_code is different than 200 (for instance 404), apache appends a default HTML error document to ...

Browser Cache Control, Dynamic Content

Problem: I can't seem to get FireFox to cache images sent from a dynamic server Setup: Static Apache Server with reverse proxy to a dynamic server (mod_perl2) at backend. Here is the request URL for the server. It is sent to the the dynamic server, where the cookie is used to validate access to the image: Request Headers Host: <OBS...

Authentication Module Issues with Apache 2 and Perl

I am SharePoint Developer trying to get a Perl module to work with Subversion, but I think something is wrong with my syntax. I just need to get the username and password, pass it into the webservice, get a true/false and authenticate based on that information. Here is the code to the module in Perl: package Apache2::AuthGetUser; #aut...