in reply to Re^3: Bareword "Apache2::Const::REDIRECT" not allowed while "strict subs" in use
in thread Bareword "Apache2::Const::REDIRECT" not allowed while "strict subs" in use
Can you point to some documentation about this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Bareword "Apache2::Const::REDIRECT" not allowed while "strict subs" in use
by jhourcle (Prior) on May 04, 2005 at 12:19 UTC | |
Hmmm... it's just been one of those things that I've taken for granted all these years, and for the life of me, I couldn't remember where I learned it. (might've been from someone, from a book, or something that I inferred). Anyway, you made me wonder if I'm potentially wrong, so I did a bit of digging on the subject. (I've found out before that things that I've thought I've known for years were actually incorrect.) It seems that &bareword is handled as special, but not for the reason I had thought. (and my C's rusty enough, that I don't know if I'm up for going through the perl source to see exactly how that syntax is treated differently. In looking through the Perl 4 documentation, there's a hint that &bareword is just a little bit different:
In a current copy of perlsub, we find a brief mention of & being special:
and further down there's a little more detail:
Looking through the current documentation, we find that package::function() syntax is a little bit special, too: o unambiguously refer to the built-in form, precede the built-in name with the special package qualifier CORE:: . For example, saying CORE::open() always refers to the built-in open() , even if the current package has imported some other subroutine called &open() from elsewhere. Even though it looks like a regular function call, it isn't: you can't take a reference to it, such as the incorrect \&CORE::open might appear to produce. So, it looks like yes, they're both special, but the reason I gave wasn't quite accurate. As well as I can get from all of this, &bareword forces backwards compatability to perl 3. merlyn stated that in the days before I was using Perl, ampersands were required. There's also a note in Exporter about problems with using barewords for constants when they're handled through AUTOLOAD. I'm not sure if this extra checking might be significant. (I'm going to need to do some testing, but I've got to run to work now). | [reply] [d/l] [select] |