Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Calling chains, extends, and subclassing

by mreece (Friar)
on Oct 04, 2006 at 17:34 UTC ( #576371=note: print w/replies, xml ) Need Help??


in reply to Calling chains, extends, and subclassing

something along these lines, perhaps (untested)?
sub new_question { my $self = shift; my $class = ref $self; ( my $question_class = $class ) =~ s{::Quiz$}{::Question}; ( my $question_module = $class ) =~ s{::}{/}g; my $question = eval { require "$question_module.pm" } ? $question_class->new( @_ ) : NHB::QuizMaster::Question->new( @_ ) ; push @{ $self->questions }, $question; $question; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://576371]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2021-02-25 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?