in reply to order of destructor calls upon call of exit()
Have the Util object keep a reference to the FTPSession object (naturally, since it needs info from that object). Have the Util destructor write to STDOUT. Then you'll know that the FTPSession object still exists at that point.
Note that this won't work if you store your objects in global variables nor if the script exits unexpectedly. You want the destructors to fire when "sub main" returns, right before "exit" is called. If the destructors fire during "global destruction", then the order of execution is out of your control.
- tye (but my friends call me "Tye")#!/usr/bin/perl -w use strict; use FTPSession; use Util; exit main(); [...] sub main { my $ftp= FTPSession->new(...); my $util= Util->new( $ftp ); [...] return 0; }
|
|---|