Hi,
I'm looking for a way to subclass HTML::Mason::Request to override the
redirect() method with custom functionality. The section on masonhq.com that
deals with subclassing mentions that there are distinct subclasses classes of
HTML::Mason::Request that are instantiated in mod_perl and mod_cgi contexts,
and that you need to use some Class::Container magic to set the correct base
class:
http://www.masonhq.com/docs/manual/Subclassing.html#request
sub new
{
my $class = shift;
$class->alter_superclass( $HTML::Mason::ApacheHandler::VERSION ?
'HTML::Mason::Request::ApacheHandler' :
$HTML::Mason::CGIHandler::VERSION ?
'HTML::Mason::Request::CGI' :
'HTML::Mason::Request' );
my $self = $class->SUPER::new(@_);
...
return $self;
}
I have done this in my class and included @ISA = qw(HTML::Mason::Request) sicne
that's the most common superclass for all request classes, but Params::Validate
barfs on the extra parameters (i.e. 'ah') sent when instantiating what is
supposed to be an instance of HTML::Mason::Request::ApacheHandler.
Since both HTML::Mason::Request::ApacheHandler and HTML::Mason::Request::CGI
have their own extended validation parameters, how do I best go about
supporting both of those with my class? Do I simply create my own
__PACKAGE__->valid_params hash containing both sets of extended params, or is
there a more elegant way?
Cheers,
Steve
--
Steve Webster
Web Architect
LOVEFiLM
-----------------------------------------------------------------------------------------------------------------------------------------
LOVEFiLM UK Limited is a company registered in England and Wales.
Registered Number: 06528297.
Registered Office: No.9, 6 Portal Way, London W3 6RU, United Kingdom.
This e-mail is confidential to the ordinary user of the e-mail address to which
it was addressed. If you have received it in error,
please delete it from your system and notify the sender immediately.
This email message has been delivered safely and archived online by Mimecast.
For more information please visit http://www.mimecast.co.uk
-----------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users