mod-perl

Apache/2.2.9, mod_perl/2.0.4: status_line doesn't seem to work

Response is prepared this way: my $r = Apache2::RequestUtil->request; $r->status_line('500 Internal Server Error'); $r->send_cgi_header("Content-Type: text/html; charset=UTF-8\n\n"); print 'Custom error message'; Request: GET /test_page HTTP/1.1 Host: www.xxx.xxx Response: HTTP/1.1 200 OK Date: XXXXXXXXXX Server: Apache/xxxxxxxx V...

Does the -f file test operator work in mod_perl?

I'm trying to use the Tenjin module but it fails because it can't find the template file but it exists. I've added some debug statements into the module and it's not passing return $filepath if (-f $filepath); even when $filepath is correct. I've tried in a standalone script and it works fine but when I copy it to the mod_perl scrip...

How do I use Apache::Reload under ActiveState Perl on Windows?

I work with Activestate Perl on Windows and Apache. I want to run my scripts under mod_perl. To prevent Apache from caching modules during development I want to use Apache::Reload module. I have added the following lines to httpd.conf PerlModule Apache::Reload PerlInitHandler Apache::Reload PerlModule Apache2::RequestUtil Then I rest...

Why does Apache mod_perl build using APACI lose CFLAGS?

I am trying to build Apache 1.3.41 with mod_perl 1.31 for deployment to a Solaris 8 SPARC server. We must use 1.3 for now because of a number of essential applications currently deployed to a very large scale web site. I am using the new(er) APACI technique as described in the mod_perl install docs but when I look at the compilation com...

Why does my mod_perl script freeze my server?

Hi! I cannot make my Perl script run stable on the server. Here is the problem. When the script is accessed more than 5 times a second, the server freezes. And some time later the server hangs forever. SSH does not respond and I have to restart the server. I'm using Apache with mod_perl. The script is hosted on Virtual Dedicated Serv...

How to minimize memory allocation of mod_perl script?

I have created a simple perl script. The only thing it does is waiting for 5 seconds. When I spawn the script on the server through mod_perl, it takes a lot of memory. The instance takes 36 megabytes. Why there is so much memory is allocated? How can I minimize the memory taken from the system by the running script? This is the output...

What is the easiest way in pure Perl to stream from another HTTP resource?

What is the easiest way (without opening a shell to curl and reading from stdin) in Perl to stream from another HTTP resource? I'm assuming here that the HTTP resource I'm reading from is a potentially infinite stream (or just really, really long) ...

Can I measure memory taken by mod_perl?

Problem: my mod_perl leaks and I cannot control it. I run mod_perl script under Ubuntu (production code). Usually there are 8-10 script instances running concurrently. According to Unix "top" utilty each instance takes 55M of memory. 55M is a lot, but I was told here that most of this memory is shared. The memory is leaking. There are...

The future of Perl? (Perl 6, Employability)

I've found a few related questions, like Python V Perl and Is Perl Worth it?, 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 s...

Why does my script use so much more memory when run with mod_perl?

I'm trying to learn how to profile perl memory. I have a very simple Perl hello-world script and I want to know its size in memory. I use GTop utility to measure the memory (recommended in mod_perl book by Stas Beckman). GTop provides the results that confuse me. When I run the script from the command line GTop says: 7M. When I run i...

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

mod_perl and inheriting STDIN in child process

Hi everyone, I have this old Perl script that is supposed to act as a proxy of sorts between HTTP-based clients and non-HTTP Java server: the client POSTs some data to this Perl script and the script would in turn call the Java server, get the response and return it to the client. The Perl part calls the server like this: $servervars ...

How can I limit the size of HTTP POST requests in mod_perl?

Hi, I'm working on a page which accepts file uploads. In theory, I can detect when the file they're sending me is too big (by looking at the Content-Length of their response), and refuse to accept the upload, returning an HTTP 413 "Request Entity Too Large" error. However, it seems that simply doing that is not enough -- Firefox, at le...

How can I defer processing during apache / mod_perl page rendering?

I have an apache2 / mod_perl website. On one page, I need to do some server/server communication via SOAP. The results of this communication are not required for the rendering of the page (but user input is required to trigger this communication). The SOAP communication is very slow. So what I want to do is process and print the page ...

Why does apache mod_perl process become a zombie?

Hey! Occasionally mod_perl apache process is marked "defunct" in "top" utility, that is becomes a zombie process. Is it a correct behavior? Do I have to worry about it? Our Perl script is very simple, it does not spawn any child processes. The zombie process disappears pretty quickly. Apache2, Ubuntu. Our apache config is here: apache...

Why does the browser hang when I register a cleanup handler in mod_perl?

I'm using $r->pool->cleanup_register(\&cleanup); to run a subroutine after a page has been processed and printed to the client. My hope was that the client would see the complete page, and Apache could continue doing some processing in the background that takes a few seconds. But the client browser hangs until cleanup sub has returned. ...

Can I use a Perl's Apache2::ASP CPAN module on shared hosting?

I'm trying to use a Perl module from CPAN (AuthCookieDBI.pm to be specific) in a shared hosting environment. I tried copying the .pm file to the directory I'm trying to use it with, and I have updated my .htaccess file as per the instructions on the AuthCookieDBI page, but my Apache log says: Invalid command 'PerlModule', perhaps missp...

How can I track down CPU intensive requests in mod_perl?

Using Apache 2.2 and mod_perl on Ubuntu 8.04 I have several applications on a server. Using Apache in pre-forking mode. Usually things are working well but once in a while I see one of Apache processes using 100% of the CPU. There are several web sites on the server with their own VirtualHosts and there are is and SVN server running vi...

Apache mod_perl handler/dispatcher returning control to apache.

Is it possible to have an apache mod_perl handler, which receives all incoming requests and decides based upon a set of rules if this request is something it wants to act upon, and if not, return control to apache which would serve the request as normal? A use-case: A legacy site which uses DirectoryIndex for serving index.html ...

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