mod-perl

Apache2 with mod_perl, it doesn't follow symlinks; How can I fix this?

mod_perl/apache doesn't seem able to follow symlinks. In httpd.conf I have: Options FollowSymLinks <VirtualHost *> ServerName cas.devserver.com ServerAlias cas.devserver.com ServerAdmin [email protected] DocumentRoot /var/www/htdocs/abc/def PerlSwitches -I/var/www/cgi-bin PerlSendHe...

How do I export Readonly variables with mod_perl?

I'm trying to make it easier to follow some Perl Best Practices by creating a Constants module that exports several of the scalars used throughout the book. One in particular, $EMPTY_STRING, I can use in just about every Perl script I write. What I'd like is to automatically export these scalars so I can use them without defining them ...

Are there good resources for porting mod_perl to Catalyst & is it worth it?

We have a big e-learning mod_perl web app, which use AxKit, XML, XLST and javascript primarily running on a unix server. What I've came to notice is that the codes are rather messy, and there has been a few generations of developers coming in and out. Due to the current structure, the task of trying to make a simple hello world webpage i...

Apache2 mod_perl Last-Modified header ignored

I have a perl generated page. The contents of this page change every 30 minutes, so I'm setting $r->set_last_modified() to the time the contents last changed. That all works well and I can see the correct header arriving at my browser. When I refresh the page, I see my browser uses the correct "If-Modified-Since" header in the request ...

How do I have mod_perl reload source files on change?

I am using mod_perl for web development. I do not want to restart mod_perl every time I modify a Perl module. I came across solution about Apache::Reload. I install this module from CPAN, modify httpd.conf accordingly & add "use Apache::Reload" at my perl module, as stated in documentation. I tried the reload all module method, & r...

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...

How can I configure Devel::SmallProf to work with mod_perl?

I have the following version being installed: Apache::SmallProf - 0.09 Apache::Registry - 2.01 Devel::SmallProf - 2.02 And I try to add the following settings in my apache config file (/usr/local/apache_modperl/conf/httpd.conf): <Perl> require Apache::DB; Apache::DB->init; </Perl> <Directory /home/website/www/cgi-m> Set...

Perl REST flow layout

I'm using Apache and Perl (modperl), with Handlers to handle requests. I'm new to this, and I'm not quite sure how to lay things out in a sensible way. Right now I have the following: package MyClass::Handler; use warnings; use strict; # includes our %action = ( 'a' => \&a, # And more ); sub handler { my $a = shift; ...

Calling clean up code in mod_perl environment

Some quote to pick from practical mod_perl "Usually, a single process serves many requests before it exits, so END blocks cannot be used if they are expected to do something at the end of each request's processing." So, in my a.cgi script : my $flag = 1; END { # Value for $flag is undefined, if this script is run under mod_perl. ...

How can I write a Perl web app that supports CGI, FastCGI and mod_perl?

How can I write a web application in Perl so that it can work as plain CGI script, as FastCGI / FCGI script, and from mod_perl / mod_perl2 (preferably using only core Perl modules and those from libwww-Perl, and minimizing number of Perl CPAN modules one has to install)? I'd like to minimize changes one has to do to change script from u...

Using Apache::Session::Memcached with MasonX::Request::WithApacheSession

I'm trying to use Apache::Session::Memcached in an HTML::Mason project where I'm using MasonX::Request::WithApacheSession to handle my sessions. Unfortunately Apache will not launch when I plug in the Memcached module instead of the MySQL one. My custom handler looks something like this (a few snips here and there): my $ah = HTML::Mas...

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 do I add a script specific lib path in mod_perl?

I'm trying to migrate CGI scripts to mod_perl using ModPerl::Registry. The scripts use modules that are in the same directory as the script, but since mod_perl current directory is elsewhere, that doesn't work. I tried using FindBin to add on to the @INC, but here's what FindBin looks like: $FindBin::Bin: /usr/sbin $FindBin::Script: h...

Catching errors with both mod_cgi & mod_perl

Thanks to everyone in advance. I've been doing some research on error handling and I don't feel like I'm getting a solid understanding of what I should do. Preamble: My code is living in Apache and executed in the browser, my goals don't include command line execution. I'd like to have the behavior of CGI::Carp (fatalsToBrowser) with ...

Change argument in the apache logs as it comes in through mod_perl?

We have impressions coming in with arguments, say user=ryan&size=1234 . Is there a way that I can change those arguments directly in the log file before they are written? We're currently using the notes() method to add argumnets but I need to change the user argument to user=ryantest before it's written. Possible? ...

Why do I get "redefine" warnings with "use constant" under mod_perl?

I run CGI script with apache2 and I have this warning lines in error.log (I removed all similar lines from the output): [Thu Jul 30 09:39:37 2009] upload.pl: Constant subroutine ModPerl::ROOT::ModPerl::Registry::home_stanislav_cgi_perl_upload_2epl::UPLOAD_DIR redefined at /usr/share/perl/5.10/constant.pm line 115, line 133. Constant s...

Modperl::perlrun reload modules

I am converting my app to run under modperl::perlrun, There are some legacy modules which create closures, Is there any way to reload Modules (.pm files ) for each request under Perlrun ? ...

Short script, long module or long script, short module?

I was just wondering what is best for performance when making a web service in Perl. Is it best to have as short as possible .pl script and put as much code as possible in a module that is used by the .pl script, or doesn't it impact performance if i don't use a module at all? I am using mod_perl on a CentOS Linux box with perl 5.8.8....

How can I provide a temp file download using mod_perl and CGI::Application?

My web app runs on Apache mod_perl using CGI::Application. I want to provide a download of a generated file. In the past (before we were using mod_perl and CGI::App) I just spooled out a csv file to STDOUT as it was generated. Now I'm shooting for a little more refinement - creating an Excel spreadsheet using Spreadsheet::WriteExcel -...

How do I get mod_perl to recognize changes to my application?

I'm running an apache2 / mod_perl2 combo on our development server. When I'm developing, my changes are instantly reflected in the webpage I'm working on. I assumed mod_perl was being clever and was reloading files when they were changed. But now another developer is working on a different part of the system and their changes are not p...