Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Eval error on connectd DBI handle

by kennethk (Abbot)
on Feb 23, 2016 at 21:43 UTC ( [id://1155964]=note: print w/replies, xml ) Need Help??


in reply to Eval error on connectd DBI handle

The problem is that Perl will not dereference DBI::db=HASH(0x40b8a38) to the original reference; the equals it is complaining about is the one after the letters db. You can replicate this with:
package PACK; sub func { print "1\n"; } package main; $obj = bless {}, 'PACK'; $obj->func; $str = "$obj->func;1"; eval $str or print $@;

This sounds a lot like an XY Problem. Why are you trying to do a string eval, instead of just the code

$dbh->do("CREATE TABLE STAIP08FK (PROBKEY varchar(20),MOBPAITS varchar +(15),SOLVER varchar(10),UNKNOWNS char(11),CONSTRAINTS char(11),OBJECT +IVE char(11),MODEL char(16),CRITERIA char(11),ITERATIONS integer,prim +ary key (PROBKEY) );"
If there's a reason to do a string eval, why aren't you escaping the dollar sigil in your original string, e.g.
$str = qq{\$dbh->do("CREATE TABLE STAIP08FK (PROBKEY varchar(20),MOBPA +ITS varchar(15),SOLVER varchar(10),UNKNOWNS char(11),CONSTRAINTS char +(11),OBJECTIVE char(11),MODEL char(16),CRITERIA char(11),ITERATIONS i +nteger,primary key (PROBKEY) );"};

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found