BIMI/Role/Data.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 100% 31 / 31 CC 2 SCAR 2.5
CC
2
Cov
100%
get_file_name
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« BIMI/Error.pm ↑ Summary BIMI/CacheBackend/FastMmap.pm »
1 package Mail::BIMI::Role::Data;
2 # ABSTRACT: Class to retrieve data files
3 29 our $VERSION = '3.20261116'; # VERSION
4 29 ▶use 5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 ▶use Mail::BIMI::Prelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use File::Slurp qw{ read_file write_file };
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10  
11 12 ▶sub get_file_name($self,$file) {
Subroutine get_file_name: called CC=2 SCAR=6.9
Pod documented
12 12 my $base_file = __FILE__;
13 12 $base_file =~ s/\/Role\/Data.pm$/\/Data\/$file/;
14 12 ▶ if ( ! -e $base_file ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $base_file) 1 11 12
15 1 die "File $file is missing";
16 }
17 11 return $base_file;
18 }
19  
20  
21 12 ▶sub get_data_from_file($self,$file) {
Subroutine get_data_from_file: called CC=1 SCAR=0.0
Pod documented
22 12 my $base_file = $self->get_file_name($file);
23 11 my $body = read_file($base_file);
24 11 return $body;
25 }
26  
27 29 1;
28  
29 __END__
« BIMI/Error.pm ↑ Summary BIMI/CacheBackend/FastMmap.pm »