diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2019-10-23 19:00:38 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2019-12-09 23:19:05 +0000 |
commit | 813e85a03dc214f719dc8248bda36156897b0757 (patch) | |
tree | 9e3c12a41469a967477219e0d0a670ab593618d2 /ext/Opcode | |
parent | e139e9c0aa8151ab29e98bb9f3216ee7a14abe4d (diff) | |
download | perl-813e85a03dc214f719dc8248bda36156897b0757.tar.gz |
Add the `isa` operator
Adds a new infix operator named `isa`, with the semantics that
$x isa SomeClass
is true if and only if `$x` is a blessed object reference that is either
`SomeClass` directly, or includes the class somewhere in its @ISA
hierarchy. It is false without warning or error for non-references or
non-blessed references.
This operator respects `->isa` method overloading, and is intended to
replace boilerplate code such as
use Scalar::Util 'blessed';
blessed($x) and $x->isa("SomeClass")
Diffstat (limited to 'ext/Opcode')
-rw-r--r-- | ext/Opcode/Opcode.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 417817929b..f20345c0dd 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -6,7 +6,7 @@ use strict; our($VERSION, @ISA, @EXPORT_OK); -$VERSION = "1.44"; +$VERSION = "1.45"; use Carp; use Exporter (); @@ -324,6 +324,7 @@ invert_opset function. lt i_lt gt i_gt le i_le ge i_ge eq i_eq ne i_ne ncmp i_ncmp slt sgt sle sge seq sne scmp + isa substr vec stringify study pos length index rindex ord chr |