> Date: Tue, 9 Mar 2010 16:40:54 -0600
> Subject: adding attributes to a database handle
> From: [email protected]
> To: [email protected]
> 
> Two questions:
> 
> 1. Is it possible to add/store "user defined" attributes in a database handle.

 

Yes

http://search.cpan.org/~timb/DBI-1.609/DBI.pm#private_your_module_name_*

 

my $foo = $dbh->{private_important_info};
  $foo ||= $dbh->{private_important_info} = { cats=>'drool',

                                                                dogs=>'rule'};

 

you should only have one and make it a hash ref so it can have any number of 
values


> 
> I'd like to do something like this:
> 
> my $dbh = DBI->connect(...);
> 
> $dbh->{important_info} = ...;
> 
> ...
> 
> print "the important info was: ", $dbh->{important_info}, "\n";
> 
> 2. Is there anything preventing the sub-classing of database handles
> (i.e. reblessing into a sub-class after creation)?

 

Not sure but give it a try will be fun to see what happens

                                          
_________________________________________________________________
Take your contacts everywhere
http://go.microsoft.com/?linkid=9712959

Reply via email to