I suggest something more like:
$a->$b() if defined $b;... but whether your code is correct really depends on the implementation of the test() method. I usually see code that just checks whether can() returns a true value.
In reply to Re^5: what does the retval of can() do ?
by chromatic
in thread what does the retval of can() do ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |