P is for Practical | |
PerlMonks |
How does strict determine if something is legally declared?by dragonchild (Archbishop) |
on Jan 10, 2006 at 03:25 UTC ( [id://522079]=perlquestion: print w/replies, xml ) | Need Help?? |
dragonchild has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing "Yet Another Perl OO Framework", primarily for fun. This is meant to be as close to my style (which is oddly very close to Ruby) for my own personal code. I doubt I will ever release this to CPAN - it's largely meant for me to play with some of the odds corners of Perl. And, I've hit one of them.
The class declaration code looks something like:
The astute observer will notice that $self is never declared anywhere, yet this does work just fine ... so long as you're not under strict. And, I have no idea why. Class::import() (called during use) creates $Class::self in the caller's namespace. I would think that the existence of this variable before the reference to $self is compiled in the body declaration would satisfy strict. But, it apparently doesn't. And, it's the oddest set of errors:
"use diagnostics" doesn't help much:
So, my questions are:
The goal here is to avoid string eval. It's ok if a solution either requires a specific Perl version or XS. In fact, I'd love it if the solution required XS - I've been looking for an actual thing for me to get my feet wet in XS. My criteria for good software:
Back to
Seekers of Perl Wisdom
|
|