Schrift
Wiki:Tipp zum Debugging: use Data::Dumper; local $Data::Dumper::Useqq = 1; print Dumper \@var;
[thread]10264[/thread]

$dbh->disconnect() wenn Objekt hinfällig



<< >> 4 Einträge, 1 Seite
pktm
 2007-08-29 18:24
#98839 #98839
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
Hallo!

Wie erreicht man, dass ein Datenbank-Handle mittels $dbh->disconnect() beendet wird, sobald das Objekt eines Moduls, welches eine Datenbankverbindung aufbaut zerstört wird oder wie auch immer man das nennt, wenn das Objekt gelöscht, zerstört oder hinfällig wird.

Einfach einen END - Block in das Modul schrieben oder wie?

Grüße, pktm
http://www.intergastro-service.de (mein erstes CMS :) )
pktm
 2007-08-29 18:54
#98844 #98844
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
DESTROY ist dein Freund...
http://www.intergastro-service.de (mein erstes CMS :) )
bloonix
 2007-09-05 00:25
#99104 #99104
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
DBI bzw Perl ist dein Freund. Du musst also nicht eine eigene sub DESTROY{}
schreiben.

Quote
The database is automatically disconnected by the DESTROY method
if still connected when there are no longer any references to the handle.
The DESTROY method for each driver should implicitly call rollback to undo any
uncommitted changes. This is vital behaviour to ensure that incomplete
transactions don't get committed simply because Perl calls DESTROY on every
object before exiting. Also, do not rely on the order of object destruction during
"global destruction", as it is undefined.
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.
pktm
 2007-09-05 03:48
#99107 #99107
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
Na umso besser.
http://www.intergastro-service.de (mein erstes CMS :) )
<< >> 4 Einträge, 1 Seite



View all threads created 2007-08-29 18:24.