You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John ORourke <jo...@o-rourke.org> on 2007/06/08 13:51:33 UTC

APR::Request::Param subclassing

Hi, I know this isn't the apreq list but....

I don't suppose anyone has an example of subclassing APR::Request::Param?

I'm trying this:

package My::Handler;
sub handler {
    ...
    my $query=Apache2::Request->new();
    my $params=$query->param();
    $params->param_class('My::Param::UTF8');
    ...
}

package My::Param::UTF8;
@ISA=qw( APR::Request::Param );
sub new {
    my $class=shift;
    my $param=$class->SUPER::new(@_);
    $param and $param->charset(8); # set as UTF-8
    bless $param,$class;
}

It just seems like a really neat solution, except that the 'new' method 
isn't being called!

cheers
John


Clinton Gormley wrote:
> Hi John
>
> I've been using libapreq, which has a charset method:
> http://search.cpan.org/~joesuf/libapreq2-2.08/glue/perl/xsbuilder/APR/Request/Param/Param.pod#charset
>