|Just another Perl shrine|
Re: More Macro work...out to export a definition to next-outer level?by ikegami (Pope)
|on Sep 30, 2010 at 06:09 UTC||Need Help??|
class_vars was being called too late to be of any use.
Putting a BEGIN block around a sub definition is useless, as a sub definition doesn't generate code to execute.
Contrary to what you said, you weren't getting a syntax error, you were getting a strict error. Quite appropriate since you asked for it.
The following simulates putting the module in its own file:
Package declarations are lexically scoped. You had lots of needless package switching.
I left in the limit that class vars must be scalars.
You call them class vars, but then you initialise them when constructing an instance, and you access them via a class instance. They're not class variables at all. They're object attributes, and you're going the wrong way about creating a singleton.
Update: Adjust the value in %INC as per reply.