Parse::CPAN::MirroredBy - Parse MIRRORED.BY
Like the other members of the Parse::CPAN family Parse::CPAN::MirroredBy parses and processes the CPAN meta data file MIRRORED.BY.
Creates a new, simple, parser object.
# Instead of the full hash just read the hostname $parser->add_map( sub { $_[0]->{hostname} } );
The add_map method adds a map stage to the filter pipeline.
add_map
A single element is passed into the provided function from the previous pipeline phase, and one or more values can be returned which will be passed on to the next pipeline phase.
Returns true if added, or throws an exception if a non-CODE reference is provided.
# We only want the daily mirrors $parser->add_grep( sub { $_[0]->{frequency} eq 'daily' } );
The add_grep method adds a grep phase to the filter pipeline.
add_grep
A single value is passed into the provided function, and the function should return true if the value is to be kept, or false if not.
# Bless into whatever objects $parser->add_bless( 'Foo::Whatever' );
For situations in which you wish to convert the pipeline values into objects directly, and don't want to do it via a map phase that passes values into a contructor, the add_bless method allows you to provide a class name that the elements of the pipe will be passed to.
add_bless
my @mirrors = $parser->parse_file( 'MIRRORED.BY' );
Once the parser is ready to process the file, the parse_file method can be provided a file name to read. It will read the file, passing the contents through the filter pipeline, and returning the resulting values as a list of results.
parse_file
my @mirrors = $parser->parse( $file_handle );
Once the parser is ready to process the file, the parse method can be provided a file handle to read. It will read from the file handle, passing the contents through the filter pipeline, and returning the resulting values as a list of results.
parse
Bugs should be reported via the CPAN bug tracker at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-CPAN-MirroredBy
Adam Kennedy <adamk@cpan.org>
Parse::CPAN::Authors, Parse::CPAN::Packages, Parse::CPAN::Modlist, Parse::CPAN::Meta
Copyright 2008 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Parse::CPAN::MirroredBy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::CPAN::MirroredBy
CPAN shell
perl -MCPAN -e shell install Parse::CPAN::MirroredBy
For more information on module installation, please visit the detailed CPAN module installation guide.