Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
My opinion is that a routine should be generous and intelligent in handling arguments, to a level which matches its code "audience." If you are the only one using the routine, then you can set this to your tastes; obviously you wouldn't spend much consideration on it if it were being used only in one script in one place, but the more places you use it the more you'll invest in making life easier for calling scripts.

If the routine is being used by other programmers, the requirements for generous argument handling jump immediately. You should process all sensible input arrangements so long as those arrangements don't compromise the routine's efficiency. I personally dislike any mechanism that requires a caller to pass arguments that tell the routine what other arguments are being passed, preferring things that can be deciphered via ref() as you mention.

I definitely don't go to multiple front-end functions for a routine unless I'm in a maintenance situation where I can't change the input handling of the target routine. I do use such arrangements where I need different output formats, though, if the output format can't be determined just on the basis of wantarray.


In reply to Re: Complexity of API argument passing by TheoPetersen
in thread Complexity of API argument passing by Masem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-23 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found