J
Jens Luedicke
Hiya..
I encountered a strange problem with an if () statement:
if ((my $r = &{$self->{onFile}}($path) != SUCCESS)) {
return $r;
}
The above code seems to ignore the return value of the function
and somehow overrides it. the return value of the called function
returns FAILED, but $r doesn't reflect that!?
The following code, works as expected:
my $r = &{$self->{onFile}}($path);
if ($r != SUCCESS)) {
return $r;
}
fyi, SUCCESS is a constant. use constant SUCCESS => 1;
both code examples should work the same. no matter what!?
do I miss something? I'm a little disturbed right now.
jens
I encountered a strange problem with an if () statement:
if ((my $r = &{$self->{onFile}}($path) != SUCCESS)) {
return $r;
}
The above code seems to ignore the return value of the function
and somehow overrides it. the return value of the called function
returns FAILED, but $r doesn't reflect that!?
The following code, works as expected:
my $r = &{$self->{onFile}}($path);
if ($r != SUCCESS)) {
return $r;
}
fyi, SUCCESS is a constant. use constant SUCCESS => 1;
both code examples should work the same. no matter what!?
do I miss something? I'm a little disturbed right now.
jens