| 1 | package B::Tools; | ||||||||||
| 2 | 2 | ▶ | use 5.008005; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION = "0.01"; | |||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use parent qw(Exporter); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | our @EXPORT = qw(op_grep op_walk op_descendants); | |||||||||
| 11 | |||||||||||
| 12 | 3 | ▶ | sub op_walk(&$) { | ||||||||
|
Subroutine
op_walk: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | 3 | my ($code, $op) = @_; | |||||||||
| 14 | 12 | ▶ | local *B::OP::walkoptree_simple = sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 12 | local $_ = $_[0]; | |||||||||
| 16 | 12 | $code->(); | |||||||||
| 17 | 3 | }; | |||||||||
| 18 | 3 | B::walkoptree($op, 'walkoptree_simple'); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 1 | ▶ | sub op_grep(&$) { | ||||||||
|
Subroutine
op_grep: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | 1 | my ($code, $op) = @_; | |||||||||
| 23 | |||||||||||
| 24 | 1 | my @ret; | |||||||||
| 25 | 4 | ▶ | op_walk { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 26 | 4 | ▶ | if ($code->()) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 1 | push @ret, $_; | |||||||||
| 28 | } | ||||||||||
| 29 | 1 | } $op; | |||||||||
| 30 | 1 | return @ret; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | ▶ | sub op_descendants($) { | ||||||||
|
Subroutine
op_descendants: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 1 | my $op = shift; | |||||||||
| 35 | 1 | my @result; | |||||||||
| 36 | 4 | ▶ | op_walk { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 37 | 4 | push @result, $_; | |||||||||
| 38 | 1 | } $op; | |||||||||
| 39 | 1 | return @result; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 2 | 1; | |||||||||
| 43 | __END__ | ||||||||||