mod-perl2

IPC::Open3 Fails Running Under Apache

I have a module that uses IPC::Open3 (or IPC::Open2, both exhibit this problem) to call an external binary (bogofilter in this case) and feed it some input via the child-input filehandle, then reads the result from the child-output handle. The code works fine when run in most environments. However, the main use of this module is in a web...

How can I determine PerlLogHandler performance impact?

I want to create a custom Apache2 log handler, and the template that is found on the apache site is: #file:MyApache2/LogPerUser.pm #--------------------------- package MyApache2::LogPerUser; use strict; use warnings; use Apache2::RequestRec (); use Apache2::Connection (); use Fcntl qw(:flock); use File::Spec::Functions qw(catfile); ...

Help troubleshoot a consistently repeatable mod_perl2 / $SIG{__DIE__} bug

This is mod_perl2 on Apache 2.2, ActiveState Perl 5.10 for win32. I override $SIG{__DIE__} and turn on DBI's RaiseError flag, which AFAICT from the docs, should call my override when a database call fails. It seems to almost always, except in one case, and I can't understand why. My script has an our $page variable, and being mod_perl...

How can I learn DOCUMENT_ROOT in startup.pl under mod_perl2?

I want to learn DOCUMENT_ROOT in startup.pl, but the best I can do is to learn server_root: use Apache2::ServerUtil (); $server_root = Apache2::ServerUtil::server_root(); which is quite useless. I can set an environment variable with SetPerlEnv DOCUMENT_ROOT /path/to/www but I don't like extra configuration if possible. Is there a...

How can I run Devel::Cover under mod_perl2?

Unfortunately, Devel::Cover does not yet work with threads. It doesn't work with prefork either. Being use'd in startup.pl, Devel::Cover issues Not a CODE reference. END failed--call queue aborted. perl 5.8.9, Apache 2.2.13. My OS is FreeBSD, if that matters. The same problem is reported for win32. Update: Here's output for PerlTra...

Active State Perl - IOCP

Hi People, I am thinking to use IOCP in perl in one of our network related code. Currently Active State Perl till 5.10 doesn't offer this feature? Is anyone aware of free module to use ASIO feature like IOCP in perl? -Karthik ...

Dumping mod_perlified variables--what's the local namespace?

I have a mod_perl script: use strict; use warnings FATAL => 'all'; use 5.010001; my $face = 'ugly'; use Data::Dump qq(pp); die pp($ModPerl::ROOT::ModPerl::Registry::C_3a_www_test_2epl::face); It dies undef at C:/www/test.pl line 8. I was expecting "ugly" at C:/www/test.pl line 8. If instead I die pp(%ModPerl::ROOT::ModPerl::Regis...

Apache won't execute CGIs with Macports Perl5.8.9

I'm trying to get perl running under on my Apache 2 macports install. I'm hoping an experienced perl geek can help me out. I've... Got Apache running just dandy. Macports installed it with perl5 placeholder and perl5.8.9. Installed mod_perl2. Run the script to configure httpd.conf. Restarted apache. Written the following test script in...

Is there a way that I can force mod_perl to re-use buffer memory?

Hi, I have a Perl script running in mod_perl that needs to write a large amount of data to the client, possibly over a long period. The behavior that I observe is that once I print and flush something, the buffer memory is not reclaimed even though I rflush (I know this can't be reclaimed back by the OS). Is that how mod_perl operates...

What is the safe way to use fork with Apache::DBI under mod_perl2?

I have a problem when I use Apache::DBI in child processes. The problem is that Apache::DBI provides a single handle for all processes which use it, so I get DBD::mysql::db selectall_arrayref failed: Commands out of sync; you can't run this command now at /usr/local/www/apache22/data/test-fork.cgi line 20. Reconnection does...

Is it a bad idea to fork under mod_perl2?

Are there any counterindications to fork under mod_perl2? Should one use another way to run background process under mod_perl2? ...

No coverage for runtime with Devel::Cover and ModPerl::Registry

When I'm running Devel::Cover with ModPerl::Registry, I get no coverage info except for BEGIN blocks. When I'm running the same script with Devel::Cover from command line or as a CGI, everything works alright (obviously). How can I make Devel::Cover "see" my code being executed in the runtime? Here's Devel::Cover related stuff in my ht...

How do I tell mod_perl2 to find my Perl modules?

I just installed my system with Oracle 64-bit Linux5.4 running Apache Server version: Apache/2.2.3 and mod_perl 2. Now, I have my Perl libraries set in a specific path: /my/perl/libs and I have adjusted my httpd.conf to compensate for this (I added the below): SetEnv MY_LIBS /my/perl/libs and in my CGI programs I'm setting my envi...

Strange behavior of '\' under mod_perl

I have the following in a script that runs under mod_perl Logger::log("\$1 = '$1'"); Logger::log("\$ 1 = '$1'"); Logger::log("\\$1 = '$1'"); Which outputs the following into my log file: logger: = '' logger: $ 1 = '' logger: \ = '' $1 is known to be null. Is this a bug in mod_perl2 or is it something else I'm missing? ...

mod_perl2 send original requested url

Hello all, I have a mod_perl module to intercept the http response fase but I just want to intercept it and satisfy that request... In other words, I want to get the request and return what the client requested... I have something like this: use strict; use Apache2::RequestRec (); # for $r->content_type use Apache2::RequestIO ()...

Too many DB connection with mod_perl2 moose application

I have a mod_perl2 based web app that requires a connection to a mysql database. I have implemented the SQL connection specifics in a moose role. Simplified, the role looks as follows: package Project::Role::SQLConnection; use Moose::Role; use DBIx::Connector; has 'connection' => (is => 'rw', lazy_build => 1); has 'dbh' => (is => 'r...

Modify POST request in mod_perl2

Does anyone know how to access/modify the POST request data using mod_perl2. IN GET method one can get/set the request QUERY string: $args = $r->args(); $prev_args = $r->args($new_args); How to get/set the request QUERY string in POST method ? ...

mod_perl handles inclusion paths differently than cgi?

I have a script that's written in perl, and executed as CGI. It works fine. Recently I have installed the mod_perl module into apache, and used the PerlModule ModPerl::Registry directive. PerlModule ModPerl::Registry PerlModule CGI PerlSendHeader On Alias /perl/ /real/path/to/perl/scripts/ <Location /perl> SetHandler perl-script Perl...

How to remove a specific set of characters from a string using regular expression in PERL

1)For example::I have a $string ="abc hell_+o w343r2d -000 rebotin".Using search pattern and regular expression is there any way to remove or chop -000 from the string in PERL. 2)I want to begin learning regular expression with examples in simple means.Which is the best tutorial to start with??? ...

Determining if the HTTP scheme is https or http in mod_perl2?

I need to work out if an incoming request is using SSL in a mod_perl environment - how can I do this reliably? ...