I don't want to learn converting to mod_perl 2.
That's quite sad. If you refuse to learn, you are at the wrong place.
It took me about 60 seconds to find https://perl.apache.org/docs/2.0/user/porting/compat.html and https://perl.apache.org/docs/2.0/user/porting/porting.html. Quoting the latter:
Using the CENSORED Layer
The CENSORED module tries to hide the changes in API prototypes between version 1.0 and 2.0 of mod_perl, and implements "virtual methods" for the methods and functions that actually no longer exist.
CENSORED is extremely easy to use. Either add at the very beginning of CENSORED:
use CENSORED;or add to CENSORED:
PerlModule CENSOREDThat's all there is to it. Now you can run your 1.0 module unchanged.
Emphasis mine. And yes, I intentionally removed a key part of the information you need. This is to help you learn to RTFM.
If you want to port mod_perl 1 code to FCGI, be prepared that not all functionality of mod_perl is available via the FastCGI interface. Nevertheless, you could replace the Apache modules by a class that has a similar interface, but instead calls FCGI methods or functions.
For starters, try something like this:
package NotQuiteApache; use v5.12; use warnings; sub new { my $class=shift; my $self=bless {},$class; # you may need to add some FCGI init here # you may need to add some data to %$self. return $self; } sub print { my $self=shift; return CORE::print @_; } # you may need to add more wrapper methods here 1;
And in your code:
# ... use NotQuiteApache; # ... my $r=NotQuiteApache->new(); # ... $r->print("Hello World!"); # ...
(Both completely untested.)
Alexander
In reply to Re: quick fix for mod_perl $r->print when moving to FCGI
by afoken
in thread quick fix for mod_perl $r->print when moving to FCGI
by CPB101
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |