The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MyCPAN::Indexer::Reporter::Base - Common bits for MyCPAN reporter classes

SYNOPSIS

Use this as a base class in you reporter classes. Extend or override the parts that you need.

DESCRIPTION

This is a base class for MyCPAN reporters. It mostly deals with file and directory names that it composes from configuration and run details. Most things should just use what is already there.

There is one abstract method that a subclass must implement on its own. The get_report_file_extension methods allows each reporter to have a unique extension by which it can recognize its own reports.

Methods

component_type

This returns the reporter_type.

get_report_path( $info, $Notes )

Returns the path of the file that stores the run results. It puts together the configuration for the {success|error}_report_subdir, the distribution name, and the distribution extension.

You should probably leave this alone.

get_report_subdir

Return the subdirectory under the report_dir for the report, depending on the success of the indexing.

get_report_filename

Returns the filename portion of the report path based on the examined distribution name.

You should probably leave this alone.

get_dist_report_subdir( FILENAME )

Creates a subdirectory path from a report name. There are 150,000 distributions so we shouldn't put all of those in one directory.

For a report such as HTTP-Size-0.01.yml, the subdirectory path is H/HT/HTTP-Size-0.01.yml. The method is fairly dumb about it since it does not care what the first two characters are. If the report name is -0.01.yml (yep, there really is), the path is -/-0/-0.01.yml.

get_report_file_extension

Returns the filename portion of the report path based on the examined distribution name. This is an abstract method which you must override.

Every reporter should chose their own extension. This allows each reporter to recognize their previous results.

get_successful_report_path( DIST )

Returns the filename for a successful report. This is slightly different from get_report_filename which might also return the filename for an success report.

get_error_report_path( DIST )

Returns the filename for a error report. This is slightly different from get_report_filename which might also return the filename for an error report.

get_success_report_subdir
get_error_report_subdir

Returns the subdirectory name for a report. This is just the subdirectory, not the full path.

The defaults are success and error.

get_success_report_dir
get_error_report_dir

Returns the path to the report directory. This combines the subdirectory name and the report path.

check_for_previous_successful_result( $dist )

Returns false (!) if it looks like there is already a successful report for the noted distribution. If there is not a successful report, it returns the filename it expected to find.

check_for_previous_error_result( $dist )

Return the report filename if there was an error report for $dist, and false otherwise.

SOURCE AVAILABILITY

This code is in Github:

git://github.com/briandfoy/mycpan-indexer.git

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright © 2008-2018, brian d foy <bdfoy@cpan.org>. All rights reserved.

You may redistribute this under the terms of the Artistic License 2.0.