Keep It Simple, Stupid | |
PerlMonks |
Re: How do I write a new sub in a git cloned CPAN module and test it by bypassing the Original Moduleby davido (Cardinal) |
on Dec 20, 2016 at 16:17 UTC ( [id://1178221]=note: print w/replies, xml ) | Need Help?? |
DateTime is an object oriented module. If you are forking it you may be doing it wrong. Rather than fork DateTime, subclass it:
The advantage to NOT modifying a locally adapted version of a CPAN module is that you won't have to keep abreast of future development for that module -- you won't be stuck either maintaining a fork of the module, or letting it grow stale. By subclassing you get to leave the original module alone, so that it is free to continue evolving with bugfixes. As long as your subclass doesn't muck with the parent class's internals, and as long as the authors of DateTime don't break its calling interface, your subclass will continue to work even if the parent is updated with future bugfixes. Plus you don't have to worry about which version Perl is loading (the issue you're currently dealing with, but would certainly deal with again if you go the route of maintaining a patched version of DateTime). Dave
In Section
Seekers of Perl Wisdom
|
|