| 1 | package File::Collector::Processor ; | ||||||||||||
| 2 | 2 | $File::Collector::Processor::VERSION = '0.038'; | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 2 | ▶ | use parent 'File::Collector'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 22 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 9 | 22 | my ($class, $all, $cselected, $files) = @_; | |||||||||||
| 10 | |||||||||||||
| 11 | 22 | ▶ | bless { _files => $files || {}, iterator => [], all => $all, | ||||||||||
|
Condition100%2/2
$files || {}
MC/DC100%1/1
$files || {}
$files
Truth table100%2/2
A
A= $files
| |||||||||||||
| 12 | selected => '', cselected => $cselected }, $class; | ||||||||||||
| 13 | } | ||||||||||||
| 14 | |||||||||||||
| 15 | 188 | ▶ | sub next { | ||||||||||
|
Subroutine
next: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 16 | 188 | my $s = shift; | |||||||||||
| 17 | 188 | ▶ | if (!$s->selected) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 18 | 18 | my @files = values %{$s->{_files}}; | |||||||||||
| 19 | 18 | $s->{iterator} = \@files; | |||||||||||
| 20 | } | ||||||||||||
| 21 | 188 | my $file = shift @{$s->{iterator}}; | |||||||||||
| 22 | 188 | $s->{selected} = $file; | |||||||||||
| 23 | 188 | ${$s->{cselected}} = $file->{full_path}; | |||||||||||
| 24 | 188 | return $s->{selected}; | |||||||||||
| 25 | } | ||||||||||||
| 26 | |||||||||||||
| 27 | 2 | ▶ | sub _isa { | ||||||||||
|
Subroutine
_isa: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 2 | my $s = shift; | |||||||||||
| 29 | 2 | my $file = shift; | |||||||||||
| 30 | 2 | return exists $s->{_files}{$file}; | |||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | 23 | ▶ | sub _add_file { | ||||||||||
|
Subroutine
_add_file: called CC=1 SCAR=0.0
| |||||||||||||
| 34 | 23 | my ($s, $file, $data) = @_; | |||||||||||
| 35 | 23 | $s->{_files}{$file} = $data; # add the file's data to processor | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 2 | ▶ | sub do { | ||||||||||
|
Subroutine
do: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 39 | 2 | my $s = shift; | |||||||||||
| 40 | 2 | bless \$s, 'File::Collector::Processor::Do'; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | { | ||||||||||||
| 44 | package File::Collector::Processor::Do; | ||||||||||||
| 45 | 2 | $File::Collector::Processor::Do::VERSION = '0.038'; | |||||||||||
| 46 | 4 | ▶ | sub AUTOLOAD { | ||||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=6.9
| |||||||||||||
| 47 | 4 | my $self = shift; | |||||||||||
| 48 | 4 | our $AUTOLOAD; | |||||||||||
| 49 | 4 | my ($method) = $AUTOLOAD =~ m/::([^:]+)$/; | |||||||||||
| 50 | 4 | ▶ | $$self->$method(@_) while ($$self->next); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | } | ||||||||||||
| 54 | |||||||||||||
| 55 | 2 | 1; # Magic true value | |||||||||||
| 56 | # ABSTRACT: Base class for custom File::Collector::Processor classes for processing files classified by a File::Collector class. | ||||||||||||
| 57 | |||||||||||||
| 58 | __END__ | ||||||||||||