Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re (tilly) 3: ref, no, maybe?

by tilly (Archbishop)
on Jan 11, 2001 at 06:01 UTC ( [id://51058]=note: print w/replies, xml ) Need Help??


in reply to (Ovid) Re(2): ref, no, maybe?
in thread ref, no, maybe?

My way of implementing merlyn's suggestion of having multiple functions with different interfaces is to have one function that constructed your query string from one of those interfaces (eg arrays) and then have another that accepts a hash-ref, repackages that in terms of array refs, and then calls the first.

So you have exactly one real implementation (should you want to change the construction of the query string it is easy to do so) yet you have two functions. One of which can't be called with a hash ref, the other which needs an array ref. Without doing any test within the function or making the implementation of the critical code more complex.

Replies are listed 'Best First'.
(tye)Re7: ref, no, maybe?
by tye (Sage) on Jan 12, 2001 at 03:06 UTC

    Note that CGI.pm does a lot of checking as to whether arguments are hash or array references. I'd be interested to see how you would redesign the CGI interfaces to avoid this.

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found