File Coverage

blib/lib/Repl/Spec/Type/ScalarType.pm
Criterion Covered Total %
statement 13 18 72.2
branch 0 2 0.0
condition 1 3 33.3
subroutine 4 6 66.6
pod 0 3 0.0
total 18 32 56.2


line stmt bran cond sub pod time code
1             package Repl::Spec::Type::ScalarType;
2            
3 1     1   4 use strict;
  1         2  
  1         27  
4 1     1   4 use warnings;
  1         2  
  1         18  
5 1     1   4 use Carp;
  1         2  
  1         154  
6            
7             # No parameters.
8             sub new
9             {
10 1     1 0 2 my $invocant = shift;
11 1   33     8 my $class = ref($invocant) || $invocant;
12 1         2 my $self = {};
13 1         66 return bless $self, $class;
14             }
15            
16             sub guard
17             {
18 0     0 0   my $self = shift;
19 0           my $arg = shift;
20            
21 0 0         return $arg if !ref($arg);
22 0           croak sprintf("Expected type scalar but received '%s'.", $arg);
23             }
24            
25             sub name
26             {
27 0     0 0   return 'scalar';
28             }
29            
30             1;