| 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
| |||||||||||
| 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__ | ||||||||||