Svein E. Seldal wrote:
Hello,

I'm running: Apache/2.0.44 (Win32) mod_perl/1.99_09-dev Perl/v5.8.0

good choice ;)


I'm toying around with mod_perl handlers. And I've written this silly little app attached below which works partly. My problem is simple:

- I need to get the querystring (and possibly the xform contents as well). And I would like to receive it parsed (in a hash). But when I use $r->args() I get the whole lot in a single variable. And I get hints from doc's lying around that args() is depreciated. How can I get the querystring anno mod_perl 2.0? Do I have to parse it myself?

$r->args in the *list* context is deprecated. See:
http://perl.apache.org/docs/2.0/user/compat/compat.html#C__r_E_gt_args__in_an_Array_Context
For now you can copy the pure-perl implementation from Apache/compat.pm. Later when Apache::Request is ported you will be able to use the faster C implementation


- The script below leaves a message in apache's error log:

Can't locate object method "request" via package "Apache::RequestRec" at D:/Prosjekt/designs/gear/gear2/Test/Test.pm line 49.

I would guess that I lack a "use Apache::SomeThing;", but I cant figure it out. (Mainly because I cant find references to it in any documentation.)

Because you haven't read this: http://perl.apache.org/docs/2.0/user/compat/compat.html#Code_Porting which at the end links you to: http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html

Also see:
http://perl.apache.org/docs/2.0/devel/porting/porting.html#Porting_mod_perl_1_0_Modules_to_Work_with_mod_perl_2_0_

package Test::Test;
use strict;
use warnings;
use Apache::Reload;
use Apache::RequestRec;
use Apache::RequestIO;
use Apache::Const -compile => qw(OK);

sub handler {
    my $r = shift;
    $r->content_type('text/plain');

print "mod_perl 2.0 rocks!\n";

    my $path_info = $r->path_info();
    print "path_info: $path_info\n";

    my $method = $r->method();
    print "method: $method\n";

    my %a = $r->args();
    my @b = %a;
    print "Args " . @b . ": @b\n";

my $content = $r->request();

/home/stas> lookup request to use method 'request' add: use Apache::RequestUtil ();

see:
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#Command_Line_Lookups


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com



Reply via email to