Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Method "do" error

by jsprat (Curate)
on Apr 20, 2003 at 21:44 UTC ( #251886=note: print w/replies, xml ) Need Help??


in reply to Method "do" error

Your code declares two lexical variables called $dbh, and each refers to a different variable. The second one masks the first - It's a brand new variable and it is undefined.

In the sub, try my $dbh = shift; in place of my $dbh;.

Replies are listed 'Best First'.
Re: Re: Method "do" error
by b310 (Scribe) on Apr 20, 2003 at 22:08 UTC
    Hi.

    I tried your suggestion with my $dbh = shift; and I'm still having no luck.
      Where did you put the my $dbh = shift in the sub store_items or the main body of the code??

      it needs to be in the sub

      sub store_items { my $dbh = shift; ....

      If this is the case then follow my previous suggestion and use Data::Dumper to print out the database handle right before your error and see what you get.

      sub store_items { my $dbh = shift; use Data::Dumper; print Dumper $dbh; ...


      grep
      Mynd you, mønk bites Kan be pretti nasti...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2016-10-01 19:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (6 votes). Check out past polls.