in reply to Sub calling sadness
Let me distill the correct answer from the various posts.
ThatPackage::blah is not defined as a sub when the call to ok is compiled, because you coded require instead of use. I don't know if that is something else you should look into, or an artifact of your testing framework.
I'm not sure, but I think use strict 'refs' would spot the problem. Why don't you have use strict at the top of your file?
So, the contents of $bar is taken as a package name at run-time (think new Blah; vs. $x="Blah"; new $x;), and the white space is a problem at this time. I don't know why it spotted it at "compile time" unless it has something to do with the constant optimizer.
Anyway, change the require to use, and then it will behave as greedy arguments to a function call without parens, since it knows that is a function.
—John
writing from 西安 (Xi'an), China
Edited 10-March re correction from ikegami (writing from 昆明 (Kunming))
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sub calling sadness
by ikegami (Patriarch) on Mar 08, 2008 at 17:50 UTC | |
|
Re^2: Sub calling sadness
by nefigah (Monk) on Mar 09, 2008 at 05:45 UTC |