Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: coding a subroutine as both method and regular function

by phaylon (Curate)
on Mar 23, 2007 at 13:49 UTC ( [id://606236]=note: print w/replies, xml ) Need Help??


in reply to coding a subroutine as both method and regular function

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://606236]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found