OVERVIEW
This is the base class for custom File::Collector::Processor
classes and is intended to package methods used to manipulate and inspect files and data contained in a File::Collector object. To keep this class small and manageable, it's recommended any heavy file processing be done inside the objects associated with the files.
File::Collector::Processor
objects are not intended to be constructed directly. Instead, they are created by their respective File::Collector
classes for you automatically.
SYNOPSIS
package File::Collector::CustomClassifier::Processor
use parent 'File::Collector::Processor';
sub a_useful_method {
my $s = shift;
# do useful stuff
...
}
sub another_useful_method {
my $s = shift;
# do more useful stuff
...
}
sub get_data {
my $s = shift;
return $s->get_obj_prop ( 'obj_name', 'some_values' );
}
DESCRIPTION
Methods in the Processor
classes are typically called from a custom File::Collector class which should use
your custom Processor
class. All methods described will be available to your Collector
class as well as the Processor
class.
$collector->some_files->do->run_method;
The do
method iterates over all the files classified under the name of the method call preceding it. In the example above, it will iterate over all the files classified under "some" by the custom Collector
classes using the _classify_file
method. For each file found in the specified category, it will call run_method
of the Processor
class returned by the do
call.
So for example, if you wanted to delete all the files classified as "bad" files, that might look something like this:
$collector->bad_files->do->delete;
The example delete
method will takes care of deleting the file for you and might look somethink like this:
sub delete {
my $s = shift;
unlink $s->selected
}
Note that we use $s->selected
to refer to the file currently selected by the Processor
's iterator. See File::Collector::Base for more details.
Initiates a Processor
class' iterator on the first call. Iterates over the files in the Processor
on subsequent calls. Returns a boolean false when the iterator is exhausted/empty. Otherwise, it returns the full path the current file in the iterator.
SEE ALSO
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 45:
Unknown directive: =method
- Around line 71:
Unknown directive: =method