B::Utils::OP(3)
β¨ NAME β¨
okay bestie, welcome to the B::Utils::OP(3) page from the User Contributed Perl Documentation π«Ά It's all about op related utility functions for perl β like, the optree side of Perl, and yes it's iconic π
π VERSION π
version 0.27, periodt β¨
π¦ SYNOPSIS π¦
okay so here's the little starter pack:
use B::Utils::OP qw(parent_op return_op);
sub foo {
my $pop = parent_op(0);
my $rop = return_op(0);
}
πΈ DESCRIPTION πΈ
so picture this sub:
sub foo {
dothis(1);
find_things();
return;
}
it has the following optree:
d <1> leavesub[1 ref] K/REFC,1 ->(end)
- <@> lineseq KP ->d
1 <;> nextstate(main -371 bah.pl:8) v/2 ->2
5 <1> entersub[t2] vKS/TARG,3 ->6
- <1> ex-list K ->5
2 <0> pushmark s ->3
3 <$> const[IV 1] sM ->4
- <1> ex-rv2cv sK/3 ->-
4 <#> gv[*dothis] s ->5
6 <;> nextstate(main -371 bah.pl:9) v/2 ->7
9 <1> entersub[t4] vKS/TARG,3 ->a
- <1> ex-list K ->9
7 <0> pushmark s ->8
- <1> ex-rv2cv sK/3 ->-
8 <#> gv[*find_things] s/EARLYCV ->9
a <;> nextstate(main -371 bah.pl:10) v/2 ->b
c <@> return K ->d
b <0> pushmark s ->c
The find_things in foo is called in the entersub in #9. If you call the parent_op function with level 0, you get the nextstate op that is before the entersub, which is #6. And return_op gives you the next op that the caller is returning to β in this case, the nextstate in #a. π«Ά
β¨ EXPORTED PERL FUNCTIONS β¨
parent_op($lv)β in runtime, returns theB::OPobject whose next is theentersubof the current context up level$lvπreturn_op($lv)β in runtime, returns theB::OPobject that the current context is returning to at level$lvπ
π B::CV METHODS π
$cv->NEW_with_start($root, $start)β clone the$cvbut with different$rootand$startπΈ
π AUTHORS π
Chia-liang Kao <clkao@clkao.org> π
π COPYRIGHT π
Copyright 2008 by Chia-liang Kao.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>.
xoxo, this page is perl v5.42.0, dated 2024-03-04, and it's still B::Utils::OP(3) β slay and goodbye bestie π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-B-Utils 0.27-bp160.1.13 Β· Artistic-1.0 or GPL-1.0+
- opensuse-leap 16.0: perl-B-Utils 0.27-bp160.1.13 Β· Artistic-1.0 or GPL-1.0+
- opensuse-leap 16.0: perl-B-Utils 0.27-bp160.1.13 Β· Artistic-1.0 or GPL-1.0+
- opensuse-leap 16.0: perl-B-Utils 0.27-bp160.1.13 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms