diff options
author | Dan Book <grinnz@grinnz.com> | 2021-08-04 15:55:35 -0400 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2021-08-22 14:53:30 +0100 |
commit | 38b5dc294ed4ebbdc84f167eb5766db6230bdbe6 (patch) | |
tree | 28c43a8b533020abe0e5256233a53096a8f01e06 /lib | |
parent | 213dc9d1dd41762afd38cca1e663ed29a5cedca8 (diff) | |
download | perl-38b5dc294ed4ebbdc84f167eb5766db6230bdbe6.tar.gz |
perlfunc 'ref' and UNIVERSAL: document isa operator alternative
Diffstat (limited to 'lib')
-rw-r--r-- | lib/UNIVERSAL.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/UNIVERSAL.pm b/lib/UNIVERSAL.pm index 12800fb54c..e73c988aba 100644 --- a/lib/UNIVERSAL.pm +++ b/lib/UNIVERSAL.pm @@ -1,6 +1,6 @@ package UNIVERSAL; -our $VERSION = '1.13'; +our $VERSION = '1.14'; # UNIVERSAL should not contain any extra subs/methods beyond those # that it exists to define. The existence of import() below is a historical @@ -87,7 +87,10 @@ inherits from (or is itself) the name of the package C<TYPE> or inherits from package C<TYPE>. If you're not sure what you have (the C<VAL> case), wrap the method call in an -C<eval> block to catch the exception if C<VAL> is undefined. +C<eval> block to catch the exception if C<VAL> is undefined or an unblessed +reference. The L<C<isa> operator|perlop/"Class Instance Operator"> is an +alternative that simply returns false in this case, so the C<eval> is not +needed. If you want to be sure that you're calling C<isa> as a method, not a class, check the invocand with C<blessed> from L<Scalar::Util> first: |