package TestPackage; use Data::Dump qw( dump ); my $obj = bless {}, __PACKAGE__; print 'Can dump()' if $obj->can( 'dump' ); print 'Can not_a_sub()' if $obj->can( 'not_a_sub' );