Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello,
I have a class called 'Datum' that implements the tied scalar interface. This class's constructor returns a tied scalar ref at present. This means that in my code, the returned scalar object must be dereferenced as '$$scalar'. The $$ dereferencing is the problem. I would like to write a method, module, C extension, or whatever it takes to have the class's new method return an object that may be used exactly as if it were a scalar, but this new magic variable also accepts method invocation and and supports running my code on STORE FETCH etc. I guess this might even be considered a new variable type, based on scalar. I know that I can tie the scalar to my Datum class all over my code, but that's very tedious as there are hundreds of them in my programs eg.
Is this possible in perl5? Would I have to write an XS module instead? Thanks! rr
|
|