Utils/Printf.pm

filter: Statementstmt 100% 31 / 31 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 92.8% 39 / 42 CC 3 SCAR 5.1
CC
3
Cov
97%
process
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Utils/Each.pm ↑ Summary Utils/Date.pm »
1 package Petal::Utils::Printf;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 ▶use base qw( Petal::Utils::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 ▶use constant name => 'printf';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use constant aliases => qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
14 5 our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2];
15  
16 6 ▶sub process {
Subroutine process: called CC=3 SCAR=11.0
Pod undocumented
17 6 my $class = shift;
18 6 my $hash = shift;
19 6 ▶ my $args = shift || confess( "'printf' expects at least 2 arguments (got nothing)!" );
Condition50%1/2
shift() || confess(q['printf' expects at least 2 arguments (got nothing)!])
l!l
60
MC/DC0%0/1
shift() || confess(q['printf' expects at least 2 arguments (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20  
21 6 my @tokens = $class->split_args( $args );
22 6 my $format = shift @tokens;
23 6 $format =~ s/\'//g;
24 6 my @printf_args = ();
25 6 foreach my $arg (@tokens) {
26 7 push @printf_args, $class->fetch_arg($hash, $arg);
27 }
28 6 return sprintf($format, @printf_args);
29 }
30  
31  
32  
33 5 1;
34  
35 __END__
« Utils/Each.pm ↑ Summary Utils/Date.pm »