in reply to Re: Calling chains, extends, and subclassing
in thread Calling chains, extends, and subclassing

Firstly, this is an awesome suggestion.


How would suggest how to load these though, eval "require $self->question_class;"; before my $question = $self->question_class->new(@_); or is there a better way to do this too?


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^3: Calling chains, extends, and subclassing
by stvn (Monsignor) on Oct 05, 2006 at 12:01 UTC
    ... is there a better way to do this too?

    Not really, UNIVERSAL::require is nice, but it pollutes UNIVERSAL, which is bad. Inside Moose we actually do this:

    my $file = $class . '.pm'; $file =~ s{::}{/}g; eval { CORE::require($file) }; confess("Could not load module '$class' because : $@") if $@;
    whenever we need to load a class. But aside from that I don't have a better suggestion.

    -stvn