JT> : Hi is there a way to make a sub/method compatible with
JT> : the two following calling methods?
JT> :
JT> : 1. MyClass::mySub();
JT> : 2. MyClass->mySub();
JT> The File::Spec::Functions module may be worth study. It wraps the
JT> methods from the File::Spec class into plain subroutines that can be
JT> exported to other packages. It's a pretty simple thing to do, and it
JT> doesn't require the methods to have any magical awareness of whether
JT> they're being called as subroutines.
and i proposed a module for a TPF grant that would allow a module author
do have that feature with little effort. it would allow an OO module to
have a default object and it would export subs into the user space which
would do call the same methods on that default object. this is similar
to what cgi,pm does but it would be generic and support any OO
module. it would also allow prefixes or renaming of the subs by the user
code.
the grant was accepted but i have since been put on the TPF committee so
i can't take the funding. if someone wants to take this project on, i
will help out with the design (as i have done most of it already) and
they can earn some grant money. the grant was approved but not formally
issued. you have to have serious understanding of OO perl, closures,
exporting to do this. it is not for newbies or the faint of heart.
email me if you are interested.
uri