Here is a code that works fine ...
I use this module as a personnal "registry". I load it with $myReg::New()
and save it with $myReg::Save().
I do not paste the funtion to change its content.
Package MyBidule;
# supressed line here
sub New {
my $ret={ } ;
if ( -e $WorkDir.$FileName ) {
$ret = retrieve( $WorkDir.$FileName);
}
else {$ret={ DEFAULT =>{} }
}
bless $ret;
return $ret;
}
sub Save {
my $self=shift;
store($self, $WorkDir.$FileName);
print "\n*Saved !" if $DEBUG;
}
return 1;
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
[EMAIL PROTECTED]
Sent: samedi 27 juillet 2002 0:03
To: [EMAIL PROTECTED]
Subject: use of Storable
I am trying to use Storable to store the contents of a hash to be used over
and over by the
program which will run at different times.
The program seems to run just fine. The file dates are updated. But the
contents never
seem to change. a code snippet is
if(-e $filename) {
print "file found\n";
$table = retrieve($filename); # load hash table
}
blse { %table = (); print "file notfound\n";} # initialize empty table
put some values into %table
$table{$key} = counter;
store (\%table, $filename);
then when I retrieve the file the second time the data hasn't changed.
Does anybody have a code snippet that works that demonstrates Storage.
I must be missing something simple.
Howard Jarea
University of Houston
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs