I would prefer using:
That is, tag output parameters by making them simply scalar references instead of references to arrays of references to scalars. Besides making the calling code simpler, it seems to me it would also simplify your called code.my $retval = $sth->exec_sp($val1, $val2, \$outval1, \$outval2 ) ); # which is the same as: my $retval = $sth->exec_sp($val1, $val2, \( $outval1, $outval2 ) );
Passing in a reference to a scalar is particularly nice because it clues the reader into the fact that that particular variable is likely to be modified. This even matches the calling conventions of bind_param() vs. bind_param_inout().
But then I'm looking at it from farther away than you. Sometimes that is helpful in preventing tunnel vision and sometimes it just means I don't see as well. (: So what advantage do you see to using the extra anonymous array? If you don't mind my asking.
- tye (but my friends call me "Tye")In reply to (tye)Re: Non-invasive API extension by use of array refs
by tye
in thread Non-invasive API extension by use of array refs
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |