On Thursday 03 May 2007 18:09, Jonathan Vanasco wrote: > On May 3, 2007, at 10:54 AM, Torsten Foertsch wrote: > > You see the location function is created directly in the > > Apache2::RequestRec > > namespace (the PACKAGE = ...). > > > > The perl equivalent would be a file named Apache2/RequestUtil.pm > > that starts > > with a "package Apache2::RequestRec" line. When you now load > > Apache2::RequestUtil all functions in the file will be added to the > > Apache2::RequestRec namespace. > > > > This is a common pattern in mod_perl. > > So then this is a documentation bug of sorts ? > > It seems like a gray area -- I can change my code to use RequestUtil > if needed, I just don't want anything that isn't written to spec.
It's quite simple. You start with use Apache2::RequestRec; then you'll have $r->prev, $r->main, $r->notes, $r->args etc. Once you need location() or pnotes() or is_initial_req() you pull in use Apache2::RequestUtil; For output you'll propably want to $r->print(...). Now you also need use Apache2::RequestIO; To use internal_redirect(), lookup_uri() etc you'll need also use Apache2::SubRequest; Note that all these functions are methods of the $r object. If you don't know what module you need for what method try perl -MModPerl::MethodLookup -e print_method METHODNAME For example $ perl -MModPerl::MethodLookup -e print_method location To use method 'location' add: use Apache2::RequestUtil (); Torsten
pgpHML3xMqsAQ.pgp
Description: PGP signature