defined &{$TEST->test_sub}
This would actually (try to) call the method...
#!/usr/bin/perl my $TEST = "foo"; if ( defined &{$TEST->test_sub} ) { } __END__ Can't locate object method "test_sub" via package "foo" (perhaps you f +orgot to load "foo"?) at ./798474.pl line 4. --- #!/usr/bin/perl my $TEST = "foo"; if ( defined &{$TEST->test_sub} ) { } package foo; sub test_sub { print "hi\n" } __END__ hi
In reply to Re^2: How to determine if a package method is defined
by almut
in thread How to determine if a package method is defined
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |