Skip to content

Instantly share code, notes, and snippets.

@exodist
Created August 9, 2020 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exodist/618cbb47be4895273b8a66049b2fbfa0 to your computer and use it in GitHub Desktop.
Save exodist/618cbb47be4895273b8a66049b2fbfa0 to your computer and use it in GitHub Desktop.
why?
!perl xxx.pl
Can xxx()
Undefined subroutine &main::xxx called at xxx.pl line 10.
Undefined subroutine &main::xxx called at xxx.pl line 11.
use strict;
use warnings;
sub xxx { 1 }
undef(&xxx);
print __PACKAGE__->can("xxx") ? "Can xxx()\n" : "Cannot xxx()\n";
eval { xxx(); 1 } or warn $@;
eval { __PACKAGE__->xxx(); 1 } or warn $@;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment