Extracting information back out of a DBH

Jonathan Stowe jns at integration-house.com
Tue Feb 10 11:49:15 GMT 2009


2009/2/10  <peter at dragonstaff.com>:
> Quoting Dave Hodgkinson <davehodg at gmail.com>:
>
>>>> my $dbh = DBI->connect('dbi:mysql:dbname', 'user', 'pass');
>>>> print Dumper( tied(%$dbh) );
>>>
>>> Ahah, the tied was just the ticket.
>>
>> Perl question: what does tied do and why is it used in this situation?
>
> I suspect it was used to provide data encapsulation and hiding in the days
> before Perl objects and closures became well known.
>

Surely tied() *breaks* the encapsulation by returning the underlying
object that implements the hash/array/scalar/handle.

/J\
-- 
http://rabidgravy.com/ - Music
http://gellyfish.co.uk/ - Everything else


More information about the london.pm mailing list