Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: passing objects as references ?

by mr.nick (Chaplain)
on Dec 08, 2011 at 15:37 UTC ( [id://942466] : note . print w/replies, xml ) Need Help??

in reply to passing objects as references ?

The problem appears to be this line:

my $sth = $dbu->execute( \$dbh, \$query, \$errmsg );

My::DBU::execute is looking for one parameter (beyond $self), a scalar, $query. $dbh is being pulled from $self, so you don't need to pass it in. And I'm not sure what passing $errmsg into the method is supposed to do.

This would probably work:

my $sth = $dbu->execute( $query );

Note that returning the statement handle is kind of odd since you retrieve the $rows inside the method.

mr.nick ...

Replies are listed 'Best First'.
Re^2: passing objects as references ?
by bbfan (Novice) on Dec 09, 2011 at 16:42 UTC
    And it did - thank you for pointing that out mr.nick! Never would have guessed in a million years to pass only one arg to a function that shifts in two; still scratching my head on that one. Regarding $sth and $rows, yes, the code is both limited and premature. Am planning on writing it more efficiently, so am grateful that both you and sundialsvc4 mentioned some db items that got me thinking; have been doing the same thing, with limited knowledge about the API, for far too long. Need to dig in there: