Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: General Class Creation Using Persistent Object, Method Privacy Enforcement and Exceptions

by DeadPoet (Scribe)
on Jun 30, 2003 at 14:56 UTC ( #270184=note: print w/ replies, xml ) Need Help??


in reply to Re: General Class Creation Using Persistent Object, Method Privacy Enforcement and Exceptions
in thread General Class Creation Using Persistent Object, Method Privacy Enforcement and Exceptions

Thanks, I missed the fact that I had hard coded the store file name but had passed the reference to the file name. The sub store_object {} should read as follows:

sub store_object { my ( $self, $sref_file ) = @_; # Caller Check my $return = $self->_caller_check(); if ( $return ) { print STDERR $$return . "\n"; return $return; } Storable::store ( \%{ $self }, $$sref_file ); return undef; }

Peace Out,

DeadPoet


Comment on Re: Re: General Class Creation Using Persistent Object, Method Privacy Enforcement and Exceptions
Select or Download Code
Re: Re: Re: General Class Creation Using Persistent Object, Method Privacy Enforcement and Exceptions
by Anonymous Monk on Jul 01, 2003 at 18:54 UTC
    Why write \%{$self}? It's a waste of both space and execution time for your code (perl may optimize it, but it's still a waste of space...) Instead, use $self, which is the exact same thing, and makes it obvious that you're putting a blessed object into the file (it took me a while to comprehend that \%{$self} somehow kept the object blessed and returned $self, itself-- this is completely countra-my previous knowledge of perl. Could somebody explain why that works?)
      After evaluating the difference between \%{ $self } and $self, I see that you are correct. I see that I am making perl perform a dereference to the same memory location. I will make corrections in my code. Thanks for the input.

      Peace Out,

      DeadPoet
      I agree. \%{$self} takes about five minutes to type. $self takes 1.618033989 seconds to type(I timed it.) To use an analogy, 1.618033989 is a lot easier than writing {sqrt(5) + 1}/2. And phi is easier still. As the author of "Walden Pond" asserted concisely, "Simplify, simplify." -100104

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://270184]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2014-09-15 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls