in reply to Re: my VS. our
in thread my VS. our

Neither script produces error messages. I added some debugging statements inside prefs.pm so I could see the execution flow (and fixed the newval statement):

pref.pm
package prefs; use strict; use Config::IniFiles; our @ISA = qw( Config::IniFiles ); sub new { my $self = shift; my $class = (ref $self) || $self; print "creating $class\n"; my $fname = 'fubar.ini'; my $obj; if (-f $fname) { $obj = $self->SUPER::new( -file => $fname ); } else { $obj = $self->SUPER::new(); $obj->SetFileName( $fname ); $obj->newval('fubar', 'var1', 'default'); } return bless($obj, $class); } sub DESTROY { my $self = shift; $self->RewriteConfig(); print "destroying $self\n"; $self->SUPER::DESTROY(@_); } 1;
Here is the output:

C:\>t1.pl creating prefs destroying prefs=HASH(0x224fc4) C:\>dir Directory of C:\ 05/26/2005 03:58 PM 23 fubar.ini 05/26/2005 03:55 PM 646 prefs.pm 05/25/2005 12:33 PM 78 t1.pl 05/25/2005 12:34 PM 79 t2.pl C:\>t2.pl creating prefs C:\>dir Directory of C:\ 05/26/2005 03:58 PM 23 fubar.ini 05/26/2005 03:58 PM 9 fubar.ini-new 05/26/2005 03:55 PM 646 prefs.pm 05/25/2005 12:33 PM 78 t1.pl 05/25/2005 12:34 PM 79 t2.pl C:\>del fubar* C:\>dir Directory of C:\ 05/26/2005 03:55 PM 646 prefs.pm 05/25/2005 12:33 PM 78 t1.pl 05/25/2005 12:34 PM 79 t2.pl C:\>t2.pl creating prefs destroying prefs=HASH(0x224fc4) C:\>dir Directory of C:\ 05/26/2005 03:59 PM 23 fubar.ini 05/26/2005 03:55 PM 646 prefs.pm 05/25/2005 12:33 PM 78 t1.pl 05/25/2005 12:34 PM 79 t2.pl C:\>t1.pl creating prefs destroying prefs=HASH(0x18245c4) C:\>dir Directory of C:\ 05/26/2005 03:59 PM 23 fubar.ini 05/26/2005 03:55 PM 646 prefs.pm 05/25/2005 12:33 PM 78 t1.pl 05/25/2005 12:34 PM 79 t2.pl

I am using Perl 5.8.6 on Win32 (Windows XP) with Config::IniFiles 2.38. I am able to reproduce the same problem on Solaris 8 with Perl 5.8.0 and Config::IniFiles 2.38.