NAME
CPAN::Testers::WWW::Reports::Parser - CPAN Testers reports data parser
SYNOPSIS
The parser can be used in two different ways, either by accessing each report as a hashref (each field having a key/value pair entry) or via an object.
The hashref access API:
use CPAN::Testers::WWW::Reports::Parser;
my $obj = CPAN::Testers::WWW::Reports::Parser->new(
format => 'YAML', # or 'JSON'
file => $file # or data => $data
);
# iterator, filtering field names
$obj->filter(@fields);
$obj->filter('ALL', @fields);
while( my $data = $obj->report() ) {
# automatically populates the returned hash with the fields required.
# removes any field values not requested, unless the first value in the
# list is the string 'ALL'.
}
$obj->filter(); # reset to default original hash
# note that filter() will also affect the reports() method.
# full array of hashes
my $data = $obj->reports(); # array of original hashes
my $data = $obj->reports(@fields); # array of amended hashes
my $data = $obj->reports('ALL',@fields); # array of original + amended hashes
The object access API:
use CPAN::Testers::WWW::Reports::Parser;
# if 'objects' was set, then $obj->report() will return
# CPAN::Testers::WWW::Reports::Report objects instead of a hashref
my $obj = CPAN::Testers::WWW::Reports::Parser->new(
format => 'YAML', # or 'JSON'
file => $file # or data => $data
objects => 1, # Optional, works with $obj->report()
);
# iterator, accessing aternate field names
while( my $data = $obj->report() ) {
my $dist = $obj->distribution(); # or $obj->dist(), or $obj->distname()
...
# note that the object is used to reference the methods retrieving
# the individual field names, as the $data variable is a hashref to a
# hash of a single report.
}
DESCRIPTION
This distribution is used to extract the data from either a JSON or a YAML file containing metadata regarding reports submitted by CPAN Testers, and available from the CPAN Testers website.
INTERFACE
The Constructor
new
Instatiates the object CPAN::Testers::WWW::Reports::Parser:
my $obj = CPAN::Testers::WWW::Reports::Parser->new( format => 'YAML', # or 'JSON' file => $file # or data => $data objects => 1 # optional, uses hash API if absent );
Report Methods
filter
Adds filtering to the report, if you require a different set of field names than exist in the default report. Add 'ALL' as the first entry to retain the default field names, and merely extend the data set.
To reset filtering, simply call filter() with no arguments.
reports
Returns the full data set as an array reference to a set of hashes. Can take arguments as per filter(), or will used any previously set filter() state.
report
Returns a single report data hash. Use filter() to set what field names you require, otherwise the default data hash is returned.
reload
The report method cycles round the current data set. If you wish to repeat the cycle, call reload to reset to the beginning of the data set.
Field methods
id
Returns the current Report NNTP ID. Note that Metabase reports will always return a zero value.
guid
Returns the current Report GUID. This is the full Metabase GUID.
distribution
dist
distname
Variations of the distribution name.
version
Distribution version.
distversion
Distribution name and version.
perl
Version of perl used to test.
state
status
grade
action
Variations on the grade of the report. Note that 'state' represents the lower case version, while the others are upper case.
osname
String extracted representing the Operating System name.
ostext
Normalised version of the Operating System name, where known, as occasionally the name may not correctly reflect a print friendly version of the name, or even the actual name.
osvers
Operating System version, if known.
platform
archname
The architecture name of the Operating System installed, as this usually gives more information about the setup of the smoke box, such as whether the OS is 64-bit or not.
url
The current path to an online version of the individual report.
csspatch
Primarily used for web, provides a quick indicator as to whether this release was tested with a patched version of perl. Possible values are:
pat - patched unp - unpatched
cssperl
Primarily used for web, provides a quick indicator as to whether this release was tested with a development version of perl. Possible values are:
rel - official release dev - development release (i.e. 5.7.*, 5.9.* or 5.11.*)
Please note that this distribution aims to aid backwards compatibility regards the contents of the reports data. If the data ever needs to change, then upgrading to the latest release of this distribution, should enable you to continue using older, depreciated field names within your code.
CPAN TESTERS FUND
CPAN Testers wouldn't exist without the help and support of the Perl community. However, since 2008 CPAN Testers has grown far beyond the expectations of it's original creators. As a consequence it now requires considerable funding to help support the infrastructure.
In early 2012 the Enlightened Perl Organisation very kindly set-up a CPAN Testers Fund within their donatation structure, to help the project cover the costs of servers and services.
If you would like to donate to the CPAN Testers Fund, please follow the link below to the Enlightened Perl Organisation's donation site.
https://members.enlightenedperl.org/drupal/donate-cpan-testers
If your company would like to support us, you can donate financially via the fund link above, or if you have servers or services that we might use, please send an email to admin@cpantesters.org with details.
Our full list of current sponsors can be found at our I <3 CPAN Testers site.
http://iheart.cpantesters.org
BUGS, PATCHES & FIXES
There are no known bugs at the time of this release. However, if you spot a bug or are experiencing difficulties, that is not explained within the POD documentation, please send bug reports and patches to the RT Queue (see below).
Fixes are dependent upon their severity and my availability. Should a fix not be forthcoming, please feel free to (politely) remind me.
RT: http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Testers-WWW-Reports-Parser
SEE ALSO
http://www.cpantesters.org/, http://stats.cpantesters.org/, http://wiki.cpantesters.org/, http://blog.cpantesters.org/
AUTHOR
Barbie <barbie@cpan.org> 2009-present
COPYRIGHT AND LICENSE
Copyright (C) 2009-2014 Barbie <barbie@cpan.org>
This module is free software; you can redistribute it and/or
modify it under the Artistic License 2.0.