If I'm reading your post correctly, you don't seem to be describing parent/child classes, but rather a single class which has the code for each of its methods placed in a separate source file -
Date::Math::DaylightSavingsTime isn't overriding
Date::Math::daylightsavingstime_in_effect to change its behavior, it's providing the implementation of
Date::Math::daylightsavingstime_in_effect.
And I really don't see any benefit to doing that in 99% of cases. (The other 1% is when you have methods which are sufficiently expensive to compile that you don't want their source code to be processed if the method isn't going to actually be used.)
It seems like it would be a lot more straightforward to just put all the code into a single module (and a single class).
That said, there are definitely ways to do the sort of thing you're asking about. The core Perl language provides the AUTOLOAD keyword to dynamically pull in (or generate) the source of not-yet-defined methods on demand. There are also several fine CPAN modules for handling plugins; I personally use all for simple plugin handling and Module::Pluggable for more complex cases.
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.