On Thu, 3 Mar 2005, Cory Trese wrote: > My major questions are: > > 1. How does a sub-class of HTML::Template construct itself? Should I > over-ride 'new( )' or use something like 'make_new( )' to wrap 'new( )' > or 'SUPER::new( )'.
package HTML::Template::Awesomer; use base 'HTML::Template'; sub new { my $pkg = shift; my $self = $pkg->SUPER::new(@_); return $self; } Of course you can insert your own code before and after the call to SUPER::new() depending what you're trying to do. > 2. What packages should my 'param( )' method be overridden in? More > than HTML::Template? In your sub-class of course. Something like: sub param { my $self = shift; $self->SUPER::param(@_); } Of course you'll want to add code to implement your extension. You should never have this line in a sub-class: > package HTML::Template; That's going to actually overwrite (not override) a subroutine in the HTML::Template namespace. Have you read Damian Conway's Object Oriented Perl book? I highly recommend it for anyone serious about doing OO in Perl. -sam ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users