| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package File::Collector::Processor ; | 
| 2 |  |  |  |  |  |  | $File::Collector::Processor::VERSION = '0.038'; | 
| 3 | 2 |  |  | 2 |  | 2262 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 57 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use warnings; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 52 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 9 | use parent 'File::Collector'; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 43 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub new { | 
| 9 | 22 |  |  | 22 | 1 | 51 | my ($class, $all, $cselected, $files) = @_; | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 22 |  | 100 |  |  | 169 | bless { _files => $files || {}, iterator => [], all => $all, | 
| 12 |  |  |  |  |  |  | selected => '', cselected => $cselected }, $class; | 
| 13 |  |  |  |  |  |  | } | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub next { | 
| 16 | 188 |  |  | 188 | 1 | 433 | my $s = shift; | 
| 17 | 188 | 100 |  |  |  | 397 | if (!$s->selected) { | 
| 18 | 18 |  |  |  |  | 30 | my @files = values %{$s->{_files}}; | 
|  | 18 |  |  |  |  | 72 |  | 
| 19 | 18 |  |  |  |  | 48 | $s->{iterator} = \@files; | 
| 20 |  |  |  |  |  |  | } | 
| 21 | 188 |  |  |  |  | 301 | my $file               = shift @{$s->{iterator}}; | 
|  | 188 |  |  |  |  | 316 |  | 
| 22 | 188 |  |  |  |  | 274 | $s->{selected}         = $file; | 
| 23 | 188 |  |  |  |  | 291 | ${$s->{cselected}}     = $file->{full_path}; | 
|  | 188 |  |  |  |  | 313 |  | 
| 24 | 188 |  |  |  |  | 462 | return $s->{selected}; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | sub _isa { | 
| 28 | 2 |  |  | 2 |  | 8 | my $s    = shift; | 
| 29 | 2 |  |  |  |  | 5 | my $file = shift; | 
| 30 | 2 |  |  |  |  | 17 | return exists $s->{_files}{$file}; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub _add_file { | 
| 34 | 23 |  |  | 23 |  | 45 | my ($s, $file, $data) = @_; | 
| 35 | 23 |  |  |  |  | 78 | $s->{_files}{$file}    = $data; # add the file's data to processor | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub do { | 
| 39 | 2 |  |  | 2 | 1 | 4 | my $s = shift; | 
| 40 | 2 |  |  |  |  | 18 | bless \$s, 'File::Collector::Processor::Do'; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | { | 
| 44 |  |  |  |  |  |  | package File::Collector::Processor::Do; | 
| 45 |  |  |  |  |  |  | $File::Collector::Processor::Do::VERSION = '0.038'; | 
| 46 |  |  |  |  |  |  | sub AUTOLOAD { | 
| 47 | 4 |  |  | 4 |  | 7 | my $self = shift; | 
| 48 | 4 |  |  |  |  | 6 | our $AUTOLOAD; | 
| 49 | 4 |  |  |  |  | 29 | my ($method) = $AUTOLOAD =~ m/::([^:]+)$/; | 
| 50 | 4 |  |  |  |  | 13 | $$self->$method(@_) while ($$self->next); | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | 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__ |