Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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 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")