Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Beatnik (493)

Beatnik
  (email not shown publicly)
http://www.ldl48.org/

A 29 year old belgian who likes Mountain Dew, Girl Scout Cookies, Tim Hortons French Vanilla Flavoured Cappucinno, Belgian beer, Belgian chocolate, Belgian women, Magners Cider, chocolate chipped cookies and Perl. Likes snowboarding, snorkling, sailing and silence. Bach can really cheer him up! He still misses his dog.

Project Daddy of Spine [sf.net], a mod_perl based CMS.

In his superhero time (8.30 AM to 5.30 PM), he works on world peace.

Journal of Beatnik (493)

Monday April 17, 2006
09:40 AM

Porting notes: mod_perl1 to mod_perl2

[ #29346 ]
A very short list of things I changed to port my app from mod_perl1 to mod_perl2. I didn't use any of the mod_perl2 funkyness but I did stick to Apache::Request (or Apache2::Request in this case).
  • To use OK, NOT FOUND and FORBIDDEN

    use Apache2::Const qw(FORBIDDEN NOT_FOUND OK);

    exports explicitly into namespace.

  • Use

    Apache2::RequestIO qw(print);

    to allow 'print' in your code.

  • There is no

    $r->send_http_header

    but use

    $r->rflush

    to force sending headers.

  • To get the remote hostname, use

    $req->connection->get_remote_host

    instead of

    $req->get_remote_host

  • When setting cookies in a redirect, instead of

    $r->header_out->('Set-Cookie' => $cookie);

    use

    $r->err_headers_out->add('Set-Cookie' => $cookie);

  • When using HTTP file upload, load

    Apache2::Upload

    .

My main goal was simply to get an existing app working on mod_perl2.. and stay away from buckets and filters and all that (just for now). I did this is about 1.5 hours (once I understood what went where etc). I plan on adding an abstraction layer so that I can provide 1 version that'll support both mod_perl versions..

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.