Welcome to the Monastery | |
PerlMonks |
Re: coding a subroutine as both method and regular functionby phaylon (Curate) |
on Mar 23, 2007 at 13:49 UTC ( [id://606236]=note: print w/replies, xml ) | Need Help?? |
As stated above, this is a bad idea for a general interface, and if it's only because it can be confusing to the users of the API. That said, there can be usages for this with utility functions. I'd either export a closure that calls my module with some defaults, or use Devel-Callers called_as_method to figure it out. But again, better design it in one clear way first that solves all problems. Start with consistence, then add convenience. Ordinary morality is for ordinary people. -- Aleister Crowley
In Section
Seekers of Perl Wisdom
|
|