mod-perl

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

☆樱花仙子☆ 提交于 2019-12-07 08:12:37
问题 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 subroutine ModPerl::ROOT::ModPerl::Registry::home_stanislav_cgi_perl_upload_2epl::BUFFER_SIZE redefined at /usr/share/perl/5.10/constant.pm line 115, line 133 (

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

跟風遠走 提交于 2019-12-06 16:38:00
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 my own generated response. For instance: GET /foo Gives: $VAR1 = bless( { 'status' => 404, 'data' => {}, 'message' => 'Resource not found for foo' }, 'My::Response' ); <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> <

Catching errors with both mod_cgi & mod_perl

↘锁芯ラ 提交于 2019-12-06 10:31:12
问题 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 the ability to capture the output and be able to throw it in my own templated page, email it etc... I did notice that fatalsToBrowser doesn't work with mod_perl.

mod_perl debugging & viewing source

落爺英雄遲暮 提交于 2019-12-06 06:23:51
问题 I've recently started work on a project that uses mod_perl. I'm attempting to use the Perl debugger to debug some Perl scripts that are running under mod_perl. I start the debugger with the following command: sudo OPTIONS="-X -DPERLDB" /etc/init.d/httpd restart The relevant debugging section of perl.conf (included by httpd.conf) is: <IfDefine PERLDB> <Perl> use Apache::DB (); Apache::DB->init; </Perl> <Location /> PerlFixupHandler Apache::DB </Location> </IfDefine> That takes me into the

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

懵懂的女人 提交于 2019-12-05 17:42:31
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 subroutine ModPerl::ROOT::ModPerl::Registry::home_stanislav_cgi_perl_upload_2epl::BUFFER_SIZE redefined at /usr/share/perl/5.10/constant.pm line 115, line 133 (#1) [Thu Jul 30 09:39:37 2009] upload.pl: Constant subroutine ModPerl::ROOT::ModPerl::Registry::home

How do I have mod_perl reload source files on change?

我的梦境 提交于 2019-12-05 08:09:38
I am developing an application with mod _ perl and restarting the server every time I change code is a huge drag. I'd like to still use mod _ perl for development because it's what I plan on using for the live server. I didn't see anything in the documentation about how to do this. Thoughts? I think Apache2::Reload will somewhat accomplish what you're looking for. However, remember to delete all this implementation once you're ready to put the app in production. Monitor All Modules in %INC To monitor and reload all modules in %INC at the beginning of request's processing, simply add the

How do I make Apache handle .pl (Perl) files, using mod_perl?

谁都会走 提交于 2019-12-05 05:21:25
I'm using Apache 2. I know how to handle .pl files as "cgi-script", but mod_perl is supposedly way faster. I successfully built and installed mod_perl, but how do I change httpd.conf so that .pl files will be handled by mod_perl (and not as cgi-script)? How to do this is described in the mod_perl documentation here . In particular, read the "Registry Scripts" section. The following is untested by myself and can be added to an existing vhost directive file PerlModule ModPerl::Registry <Files ~ "\.(pl|cgi)$"> SetHandler perl-script PerlResponseHandler ModPerl::Registry Options +ExecCGI

Perl REST flow layout

强颜欢笑 提交于 2019-12-05 02:31:57
问题 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; my $r = Apache2::Request->new($a); # Do things return Apache2::Const::OK(); } Should I have a different file for each "space"? Using stackoverflow as a template, do I need a User

What criteria should I use to evaluate a Perl “app server” (mod_perl replacement)?

你。 提交于 2019-12-03 08:59:00
问题 Short version : What criteria should I use to evaluate possible candidates for a Perl "app server" (mod_perl replacement)? We are looking for some sort of framework which will allow executing various Perl programs repeatedly (as a service) without the costs of: re-launcing perl interpreter once per each execution loading/compiling Perl modules once per execution (both of which are the benefits that running mod_perl provides) Notes: We do NOT much care about any additional benefits afforded by

The future of Perl? (Perl 6, employability)

白昼怎懂夜的黑 提交于 2019-12-03 06:53:49
问题 I've found a few related questions, like Python vs. Perl (now deleted) and Is Perl Worth it? (now deleted), but I can't seem to find anything that directly addresses this question. Is there a legitimate future in Perl? I work in a Perl shop right now, and I came from PHP so I see some of the advantages of an arguably "lower" level language when doing things on the server-level, but it seems to me a lot of the tasks in Perl can be performed more quickly in PHP, and SOME ARGUE (subjective, not