| 1 | package Devel::NYTProf::Constants; | ||||||||||
| 2 | |||||||||||
| 3 | 701 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 701 | ▶ | use Devel::NYTProf::Core; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 701 | ▶ | use base 'Exporter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 701 | our @EXPORT_OK = qw(const_bits2names); | |||||||||
| 10 | |||||||||||
| 11 | 701 | my $const_bits2names_groups; | |||||||||
| 12 | |||||||||||
| 13 | 701 | do { | |||||||||
| 14 | 701 | ▶ | my $symbol_table = do { no strict; \%{"Devel::NYTProf::Constants::"} }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 701 | my %consts = map { $_ => $symbol_table->{$_}() } grep { /^NYTP_/ } keys %$symbol_table; | |||||||||
| 16 | |||||||||||
| 17 | 701 | push @EXPORT_OK, keys %consts; | |||||||||
| 18 | |||||||||||
| 19 | 701 | for my $sym (keys %consts) { | |||||||||
| 20 | 32947 | ▶ | $sym =~ /^(NYTP_[A-Z]+[a-z])_/ or next; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 30143 | $const_bits2names_groups->{$1}{ $consts{$sym} } = $sym; | |||||||||
| 22 | } | ||||||||||
| 23 | }; | ||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub const_bits2names { # const_bits2names("NYTP_FIDf",$flags) | ||||||||
|
Subroutine
const_bits2names: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($group, $bits) = @_; | |||||||||
| 28 | 0 | ▶ | my $names = $const_bits2names_groups->{$group} or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | my @names; | |||||||||
| 30 | 0 | for my $bit (0..31) { | |||||||||
| 31 | 0 | my $bitval = 1 << $bit; | |||||||||
| 32 | 0 | ▶ | push @names, $names->{$bitval} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | if $bits & $bitval; | ||||||||||
| 34 | } | ||||||||||
| 35 | 0 | ▶ | return @names if wantarray; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | return join " | ", @names; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | # warn scalar const_bits2names("NYTP_FIDf", NYTP_FIDf_SAVE_SRC|NYTP_FIDf_IS_PMC); | ||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | #warn "Constants: ".join(" ", sort @EXPORT_OK); | ||||||||||
| 43 | |||||||||||
| 44 | 701 | 1; | |||||||||