I have in my base class use Storable qw/nfreeze thaw/; but I cannot access nfreeze in my child class. I am calling it in child class like nfreeze($data).
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Storable::nfreezeandStorable::thaware functions and not methods — they do not expect an object of a particular type or a package name as their first arguments. In general, you call these subroutines directly (nfreeze($data)) rather than with indirect syntax ($obj->thaw()) and so you should not expect them to be in the set of inherited methods.To use these functions in your child class, import them into your child package
or call the functions with their fully qualified subroutine names:
The second call works because
nfreeze/thawwould have already been imported into theBaseClassnamespace.