DateTime.pm

filter: Statementstmt 58.6% 17 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 62.5% 5 / 8 Podpod 100% 2 / 2 totaltotal 50.0% 24 / 48 CC 5 SCAR 21.1
CC
5
Cov
47%
datetime
20.0
new
6.0
_datetime_from_filesystem_stamp
2.0
CRAP 8.2
« DateTime/JPEG.pm ↑ Summary
1 package Media::DateTime;
2  
3 # ABSTRACT: A simple module to extract the timestamp from media files in an flexible manner.
4  
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 our $VERSION = '0.49';
9  
10 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 use Module::Pluggable
13 3 ▶ search_path => 'Media::DateTime',
Subroutine BEGIN: called CC=1 SCAR=0.0
14 require => 1,
15 3 sub_name => 'matchers';
16  
17 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
18 0 my $that = shift;
19 0 ▶ my $class = ref($that) || $that; # Enables use to call $instance->new()
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
20 0 return bless {}, $class;
21 }
22  
23 0 ▶sub datetime {
Subroutine datetime: not called CC=4 SCAR=30.0
Pod documented
24 0 my ( $self, $f ) = @_;
25 0 for my $class ( $self->matchers ) {
26 0 ▶ if ( $class->match($f) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->match($f)) 0 0 0
27 0 my $v = $class->datetime($f);
28 0 ▶ return $v if defined $v;
Branch: 1 branch
BranchTrueFalseTotal
if defined $v 0 0 0
29 }
30 }
31 0 return $self->_datetime_from_filesystem_stamp($f);
32 }
33  
34 0 ▶sub _datetime_from_filesystem_stamp {
Subroutine _datetime_from_filesystem_stamp: not called CC=1 SCAR=6.9
35 0 my ( $self, $f ) = @_;
36  
37 0 my $c_date = ( stat($f) )[9];
38 0 return DateTime->from_epoch( epoch => $c_date, time_zone => 'local' );
39 }
40  
41 3 1;
42  
43 __END__
« DateTime/JPEG.pm ↑ Summary