blib/lib/Attribute/SubName.pm

filter: Statementstmt 100% 29 / 29 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 95.1% 39 / 41 CC 3 SCAR 4.4
CC
3
Cov
97%
Name
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
↑ Summary
1 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Attribute::SubName;
6 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $Attribute::SubName::VERSION = '1.101420';
8 }
9 # ABSTRACT: Naming anonymous subroutines via attributes
10  
11 2 ▶use Sub::Name;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use parent 'Attribute::Handlers';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶sub UNIVERSAL::Name : ATTR(CODE) {
Subroutine Name: called CC=3 SCAR=11.0
Pod undocumented
15 1 my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
16 1 ▶ $data = [$data] unless ref $data eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $data eq "ARRAY" 0 1 1
17 1 for my $item (@$data) {
18 1 my $name = "${package}::${item}";
19 1 subname $name => $referent;
20 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 *{$name} = $referent;
22 }
23 2 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 1;
25  
26  
27 __END__
↑ Summary