for $x ('main', undef, \1) { if (UNIVERSAL::can($x, 'can')) { # ok print "can can\n"; $x->can('foo'); print "\n"; } else { # error: Can't call method "can" on undefined value/unblessed refe +rence ... print "can't can\n"; eval { $x->can('foo') }; print "$@\n"; } }
In reply to Re: Re: Re: Re: Re: Calling can method
by chipmunk
in thread Calling can method
by gildir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |