Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I dump blessed hash ref?

Tags:

perl

  DB<126> x $dbh
0  DBI::db=HASH(0x11e0bd0)
     empty hash

It seems I can't dump its content no matter how many stuff I assign to it by $dbh->{$a} = $v

why?

like image 578
new_perl Avatar asked May 10 '26 17:05

new_perl


2 Answers

DBI handles are an example of inside out objects; they squirrel away their attributes where you in theory can't get them except through their interface. (Unlike many newer implementations of inside out objects, they also have a tie interface that allows you to get and set attributes as if they were blessed hashes, but in a controlled way.)

like image 139
ysth Avatar answered May 13 '26 21:05

ysth


If you are trying to debug DBI consider using DBI's powerful tracing method which works for the database driver as well as DBI itself.

like image 39
marto Avatar answered May 13 '26 22:05

marto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!