On 9/20/06, Honza Pazdziora <[EMAIL PROTECTED]> wrote:
On Mon, Sep 18, 2006 at 12:27:57PM -0400, Matthew Persico wrote:
> For your reference:
> sub dump_results { # also aliased as a method in DBD::_::st
> my ($sth, $maxlen, $lsep, $fsep, $fh) = @_;
[...]
> I would like to add another parameter that would suppress the rowcount
print
> as long as there are no errors. In theory:
>
> sub dump_results { # also aliased as a method in DBD::_::st
> my ($sth, $maxlen, $lsep, $fsep, $fh, $suppress_rowcount) = @_;
[...]
> In practice, I think that I'd also like to add also add
$suppress_errors.
> Seems to me that what we should really do is:
>
> sub dump_results { # also aliased as a method in DBD::_::st
> my ($sth, $maxlen, $lsep, $fsep, $fh, $hr_attribs) = @_;
> ## hr_ is "hungarian" for hash ref. Not neccessary, but for this
> example, I'll use it for clarity
Why not make the attributes hashref an optional second parameter
after $sth, with $maxlen, $lsep, $fsep, $fh being specified either in
the hash, or (overidding) after as plain @_ arguments?
That way you'd not need to specify a list of undefs if you just
wanted to change suppress_errors or any other new parameter but
wanted to keep $maxlen, $lsep, $fsep, and $fh default. Distinguishing
when the hashref is present or missing should be a matter of
ref($_[1]).
Yes, that's a better way, but I didn't feel like making that radical an
addition to the interface.
--
------------------------------------------------------------------------
Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
.project: Perl, C, Red Hat Network, IPv6, VoIP
Only self-confident people can be simple.
--
Matthew O. Persico