Object Reference
Jason Annin-White
jasona at inetarena.com
Mon Jul 22 17:03:47 CDT 2002
Tom,
I didn't recieve the email from Randal. I haven't gotten many messages
from the list in a week or so. I assumed it was because everybody was
playing with 5.8 but maybe there's a problem someplace.
Jason White
Tom Phoenix wrote:
>On Fri, 19 Jul 2002, Jason White wrote:
>
>>I'm using Data::Dumper to save and restore objects.
>>
>
>Didn't you see what Randal wrote to you about doing this? If you don't
>want to follow his advice, that's your right. But by doing so, you're
>implying that you have a good reason for ignoring Randal's suggestions.
>
>>sub RestoreFromFile($){
>> my ($filename,$tmp,$VAR1);
>> $filename=shift;
>> $tmp="";
>> open(INFILE, "$filename");
>>
>
>I'm sure that you put those quote marks in there because you wanted to
>exercise your typing fingers. So why not get even more exercise by pushing
>the backspace key after you typed them? :-) And it sure looks like you're
>not checking the return value from open(). Hmmm.
>
>> while(<INFILE>){
>> $tmp.=$_;
>> }
>> eval $tmp;
>>
>
>And you should check the result of $@ after an eval(), too, if you really
>must use eval. But what you're doing here looks a lot like the do()
>builtin. Right?
>
>> return $VAR1; # returns a reference to an object
>># Why does Data::Dumper format the dump so nicely?
>>
>
>Randal addressed that question in his earlier message. If you've misplaced
>it, I could send you a copy. :-)
>
>In the hope that it'll get you back on track, here's the executive summary
>of Randal's message:
>
> use Storable;
>
>Happy coding!
>
>--Tom Phoenix
>
>
>
>
TIMTOWTDI
More information about the Pdx-pm-list
mailing list