Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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:
    http://search.cpan.org/~timb/DBI-1.616/DBI.pm

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found