diff options
author | Norbert Preining <norbert@preining.info> | 2024-03-15 03:06:35 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-03-15 03:06:35 +0000 |
commit | 12679ab7d3c2a210f4123163671b532b8b55d5f9 (patch) | |
tree | 0060d13467186ad977f4e73488ee20dd6c0017ab /systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm | |
parent | 62170822e034fdd3f81de7274835d0d3b0467100 (diff) |
CTAN sync 202403150306
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm')
-rw-r--r-- | systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm index ef23af6baa..d0a04c6a12 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/B.pm @@ -20,7 +20,7 @@ sub import { # walkoptree comes from B.xs BEGIN { - $B::VERSION = '1.82'; + $B::VERSION = '1.88'; @B::EXPORT_OK = (); # Our BOOT code needs $VERSION set, and will append to @EXPORT_OK. @@ -62,6 +62,7 @@ push @B::EXPORT_OK, (qw(minus_c ppname save_BEGINs @B::CV::ISA = 'B::PVMG'; @B::IO::ISA = 'B::PVMG'; @B::FM::ISA = 'B::CV'; +@B::OBJ::ISA = 'B::PVMG'; @B::OP::ISA = 'B::OBJECT'; @B::UNOP::ISA = 'B::OP'; @@ -88,6 +89,12 @@ our @specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no (SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD &PL_sv_zero); +# Back-compat +{ + no warnings 'once'; + *CVf_METHOD = \&CVf_NOWARN_AMBIGUOUS; +} + { # Stop "-w" from complaining about the lack of a real B::OBJECT class package B::OBJECT; @@ -299,7 +306,7 @@ B - The Perl Compiler Backend The C<B> module supplies classes which allow a Perl program to delve into its own innards. It is the module used to implement the "backends" of the Perl compiler. Usage of the compiler does not -require knowledge of this module: see the F<O> module for the +require knowledge of this module: see the L<O> module for the user-visible part. The C<B> module is of use to those who want to write new compiler backends. This documentation assumes that the reader knows a fair amount about perl's internals including such @@ -593,6 +600,26 @@ C<REFCNT> (corresponding to the C function C<SvREFCNT>). =item FLAGS +=item IsBOOL + +Returns true if the SV is a boolean (true or false). +You can then use C<TRUE> to check if the value is true or false. + + my $something = ( 1 == 1 ) # boolean true + || ( 1 == 0 ) # boolean false + || 42 # IV true + || 0; # IV false + my $sv = B::svref_2object(\$something); + + say q[Not a boolean value] + if ! $sv->IsBOOL; + + say q[This is a boolean with value: true] + if $sv->IsBOOL && $sv->TRUE_nomg; + + say q[This is a boolean with value: false] + if $sv->IsBOOL && ! $sv->TRUE_nomg; + =item object_2svref Returns a reference to the regular scalar corresponding to this @@ -601,6 +628,24 @@ to the svref_2object() subroutine. This scalar and other data it points at should be considered read-only: modifying them is neither safe nor guaranteed to have a sensible effect. +=item TRUE + +Returns a boolean indicating hether Perl would evaluate the SV as true or +false. + +B<Warning> this call performs 'get' magic. If you only want to check the +nature of this SV use C<TRUE_nomg> helper. + +This is an alias for C<SvTRUE($sv)>. + +=item TRUE_nomg + +Check if the value is true (do not perform 'get' magic). +Returns a boolean indicating whether Perl would evaluate the SV as true or +false. + +This is an alias for C<SvTRUE_nomg($sv)>. + =back =head2 B::IV Methods @@ -1313,6 +1358,8 @@ pointers and B::PADNAME objects otherwise. =item REFCNT +=item GEN + =item FLAGS For backward-compatibility, if the PADNAMEt_OUTER flag is set, the FLAGS @@ -1349,6 +1396,10 @@ Only meaningful if PADNAMEt_OUTER is set. Only meaningful if PADNAMEt_OUTER is set. +=item IsUndef + +Returns a boolean value to check if the padname is PL_padname_undef. + =back =head2 $B::overlay |