Please note that you're loading the object from a file with the name of the dereferenced $sref_file, but you're storing it in './object.dat,' even though you pass $sref_file to that as well- that's simple to fix :)
I'm also not a big fan of
Exception; rather, I like to use
Error. I just love being able to throw different types of errors with about two seconds of code as well as the utter extensibility that
Error provides:
package SomeError; @ISA = qw(Error::Simple);
Then you can throw an error of type 'SomeError', and you can create even more complicated hierarchies of errors so easily with Error.pm (just have another, more specific subset of SomeError inherit from it.) It's a perfect use of Universal::isa().
Error's errors also propogate down, so if you throw an exception on an upper sub, you can catch it later. This allows you to not have to return the error if there is one, and instead follow the standard rule of 0 or undefined on failure, and true of success (you could still do this, but Error.pm makes it really intuitive to me.) Furthermore, you wouldn't have to comment out the thrown errors, because if they weren't asking to be caught somewhere, they'd never really be used (this is my knowledge of Error.pm- just use record(), and never catch the error. However, this is possible using either error module again, probably)...
Also, afaik-
\%{ $self } == $self, so
Storable::store ( \%{ $self }, './object.dat' ); could be
Storable::store ($self,'./object.dat' );.
Instead of storable, I'm also becomming a fan of
YAML, if you haven't tried it- try it! It's pretty cool, and you can actually read the files it generates (I'm not sure if it'd be good for saving a reference to an object, because I've never tried that using it, but I expect it would do fine...)