Never mind, problem solved by using or. Geez, did I over look the obvious...
For those that need it.....
eval "$PAGE" if main->can($PAGE) or main->nopageerror;
Thanks again radiant.matrix for the push in the right direction. | [reply] [d/l] |
That does work because of the super-low-precedence of 'or'.Actually, it doesn't work. The if wants to evaluate all of the following expression. It's not very readable, thougheither.: someone who doesn't understand the lower-precedence-ness of 'or' (compared to '||', especially). To them it would look like you shouldIt will try to eval $PAGE if one of the two or statements is true. Also, you don't need to specify main-> for nopageerror.
For clarity, I suggest one of these:
# whoops, syntax errors, thanks to Roy Johnson
## ( eval "$PAGE" if main->can($PAGE) ) or nopageerror;
## or...
#( eval "$PAGE" if main->can($PAGE) )
# or nopageerror;
## or...
if ( main->can($PAGE) ) { eval $PAGE }
else { nopageerror }
Updates:
- 2005-09.Sep-30 : fixed stupid errors as pointed out by Roy Johnson. Don't code without coffee, kids! :-)
<-radiant.matrix->
Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law
| [reply] [d/l] |
| [reply] [d/l] |
You are correct radiant.matrix. I'm always forgetting the ||/or methods. Simularily I confuse the eq and = and == thus causing scripting errors.... The simplest things are generally the easiest to over look and cause the most problems.
| [reply] |