Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Perl templating/macro creating using 'BEGIN'...by Corion (Patriarch) |
on Sep 27, 2010 at 17:04 UTC ( [id://862248]=note: print w/replies, xml ) | Need Help?? |
Why do you put this in a BEGIN block? It serves no purpose, at least when Perl looks at it. Also, why are you using string-eval, when the plain eval works just as well. Also see Class::Accessor.
In this next snippet from MyPackage, I don't understand why you use string-eval, and also why you try to execute the same statement twice:
The subroutine package_vars3 does not exist:
What problem are you trying to solve? Do you want to have a hash using which you get/set variables? Maybe an object based on a plain hash using AUTOLOAD is already enough? If you want control over what keys get stored, again, see Class::Accessor.</c>
In Section
Seekers of Perl Wisdom
|
|