lib/Test2/Harness/UI/Util/Errors.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 45 CC 3 SCAR 16.7
CC
3
Cov
0%
is_error_code
12.0
code
2.0
BEGIN
2.0
CRAP 5.3
1 package Test2::Harness::UI::Util::Errors;
2 use strict;
3 use warnings;
4  
5 our $VERSION = '0.000150';
6  
7 use Scalar::Util qw/blessed/;
8  
9 use Importer Importer => 'import';
10  
11 our @EXPORT = qw/is_error_code/;
12  
13 sub is_error_code {
14 my $thing = shift;
15 return undef unless blessed($thing);
16 return undef unless $thing->isa(__PACKAGE__);
17 return $$thing;
18 }
19  
20 for my $code (400 .. 405) {
21 my $val = 0 + $code;
22 my $ref = bless \$val, __PACKAGE__;
23 my $name = "ERROR_$code";
24 push @EXPORT => $name;
25  
26 no strict 'refs';
27 *{$name} = sub() { $ref };
28 }
29  
30 sub code { ${$_[0]} }
31  
32 1;
33  
34 __END__