I could tell the solution I'm currently working on, and I have a few, but I really want the full breadth of what PM has to offer on this one.
I've made a testing system it works as follows:
- uses Moose
- are 3 baseclasses, one for Quizzes, one for Questions and one for Answers.
- I need to provide the easy ability to sublcass them
In side the Quiz.pm I have problem code such as:
sub new_question {
my $self = shift;
my $question = new NHB::QuizMaster::Custom::NHMCC::Question( @_ );
push @{ $self->questions }, $question;
$question;
}
That code is what I'm trying to kill, see the base classes, are in NHB::QuizMaster, but a user can add plugin/custom types that extend those, (are subclasses of them) in NHB::QuizMaster::Custom, the names are assumed to be the same Quiz.pm/Answer.pm/Question.pm. How can I make it so when someone subclasses both Quiz, AND Question, they don't have to statically type a package for the Question.
Can I make a lib hack, that adds the path to the MODULE (not the origin the script ran at). Or is there an entirely better solution to set the calling chain up?
I would like it so if the user says something like
new NHB::QuizMaster::Custom::NHMCCD::Quiz that this quiz which
Moose extends NHB::QuizMaster::Quiz first looks in its own path NHB::QuizMaster::Custom::NHMCCD, for Question.pm, and then in the path of NHB::QuizMaster...
Thanks in advance
Evan Carroll
www.EvanCarroll.com
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.