| 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
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 27 | 0 | my $v = $class->datetime($f); | |||||||||||||||||||
| 28 | 0 | ▶ | return $v if defined $v; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||