lib/Dancer/Deprecation.pm

filter: Statementstmt 100% 28 / 28 Branchbran 91.6% 11 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 97.8% 45 / 46 CC 7 SCAR 15.7
CC
7
Cov
98%
deprecated
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« lib/Dancer/Engine.pm ↑ Summary lib/Dancer/Error.pm »
1 package Dancer::Deprecation;
2 244 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: handle deprecation messages
4 244 $Dancer::Deprecation::VERSION = '1.3522';
5 244 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 244 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 244 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 244 ▶use Dancer::Exception qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 ▶sub deprecated {
Subroutine deprecated: called CC=7 SCAR=19.5
Pod documented
11 5 my ($class, %args) = @_;
12  
13 5 my ( $package, undef, undef, $sub ) = caller(1);
14  
15 5 ▶ unless ( defined $args{feature} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $args{"feature"}) 3 2 5
16 3 $args{feature} = $sub;
17 }
18  
19 5 ▶ my $deprecated_at = defined $args{version} ? $args{version} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'version'} ? : 2 3 5
20  
21 5 my $msg;
22 5 ▶ if ( defined $args{message} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{'message'}) { } 2 3 5
23 2 $msg = $args{message};
24 }
25 else {
26 3 $msg = "$args{feature} has been deprecated";
27 }
28 5 ▶ $msg .= " since version $deprecated_at" if defined $deprecated_at;
Branch: 1 branch
BranchTrueFalseTotal
if defined $deprecated_at 2 3 5
29 5 ▶ $msg .= ". " . $args{reason} if defined $args{reason};
Branch: 1 branch
BranchTrueFalseTotal
if defined $args{"reason"} 0 5 5
30  
31 5 ▶ raise core_deprecation => $msg if $args{fatal};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"fatal"} 1 4 5
32 4 carp($msg);
33 }
34  
35 244 1;
36  
37 __END__
« lib/Dancer/Engine.pm ↑ Summary lib/Dancer/Error.pm »