| 1 | # Declare our package | ||
| 2 | package CPAN::WWW::Top100::Retrieve::Dist; | ||
| 3 | 1 | ▶ | use strict; use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # Initialize our version | ||
| 6 | 1 | ▶ | use vars qw( $VERSION ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | $VERSION = '0.01'; | |
| 8 | |||
| 9 | # import the Moose stuff | ||
| 10 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use MooseX::StrictConstructor; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 1 | has 'type' => ( | |
| 15 | isa => 'Str', | ||
| 16 | is => 'ro', | ||
| 17 | required => 1, | ||
| 18 | ); | ||
| 19 | |||
| 20 | 1 | has 'dbid' => ( | |
| 21 | isa => 'Int', | ||
| 22 | is => 'ro', | ||
| 23 | required => 1, | ||
| 24 | ); | ||
| 25 | |||
| 26 | # Common to all types | ||
| 27 | 1 | has 'rank' => ( | |
| 28 | isa => 'Int', | ||
| 29 | is => 'ro', | ||
| 30 | required => 1, | ||
| 31 | ); | ||
| 32 | |||
| 33 | 1 | has 'author' => ( | |
| 34 | isa => 'Str', | ||
| 35 | is => 'ro', | ||
| 36 | required => 1, | ||
| 37 | ); | ||
| 38 | |||
| 39 | 1 | has 'dist' => ( | |
| 40 | isa => 'Str', | ||
| 41 | is => 'ro', | ||
| 42 | required => 1, | ||
| 43 | ); | ||
| 44 | |||
| 45 | 1 | has 'score' => ( | |
| 46 | isa => 'Int', | ||
| 47 | is => 'ro', | ||
| 48 | required => 1, | ||
| 49 | ); | ||
| 50 | |||
| 51 | # from Moose::Manual::BestPractices | ||
| 52 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 53 | 1 | __PACKAGE__->meta->make_immutable; | |
| 54 | |||
| 55 | 1 | 1; | |
| 56 | __END__ | ||
| 57 | |||
| 58 | =for stopwords todo dbid dist | ||
| 59 | |||
| 60 | =head1 NAME | ||
| 61 | |||
| 62 | CPAN::WWW::Top100::Retrieve::Dist - Represents a distribution listed in the Top100 | ||
| 63 | |||
| 64 | =head1 SYNOPSIS | ||
| 65 | |||
| 66 | #!/usr/bin/perl | ||
| 67 | use strict; use warnings; | ||
| 68 | use CPAN::WWW::Top100::Retrieve; | ||
| 69 | |||
| 70 | my $top100 = CPAN::WWW::Top100::Retrieve->new; | ||
| 71 | foreach my $dist ( @{ $top100->list( 'heavy' ) } ) { | ||
| 72 | print "Heavy dist(" . $dist->dist . ") rank(" . $dist->rank . | ||
| 73 | ") author(" . $dist->author . ") score(" . | ||
| 74 | $dist->score . ")\n"; | ||
| 75 | } | ||
| 76 | |||
| 77 | =head1 DESCRIPTION | ||
| 78 | |||
| 79 | This module holds the info for a distribution listed in the Top100. | ||
| 80 | |||
| 81 | =head2 Attributes | ||
| 82 | |||
| 83 | Those attributes hold information about the distribution. | ||
| 84 | |||
| 85 | =head3 type | ||
| 86 | |||
| 87 | The type of Top100 this dist is listed on. | ||
| 88 | |||
| 89 | example: heavy | ||
| 90 | |||
| 91 | =head3 dbid | ||
| 92 | |||
| 93 | The dbid of Top100 this dist is listed on. | ||
| 94 | |||
| 95 | =head3 rank | ||
| 96 | |||
| 97 | The rank of this dist on the Top100 list. | ||
| 98 | |||
| 99 | =head3 author | ||
| 100 | |||
| 101 | The author of this dist. | ||
| 102 | |||
| 103 | =head3 dist | ||
| 104 | |||
| 105 | The distribution name. | ||
| 106 | |||
| 107 | =head3 score | ||
| 108 | |||
| 109 | The score of the distribution on the Top100 list. | ||
| 110 | |||
| 111 | If the type is: heavy | ||
| 112 | |||
| 113 | The score is the number of downstream dependencies | ||
| 114 | |||
| 115 | If the type is: volatile, debian, downstream, meta1/2/3 | ||
| 116 | |||
| 117 | The score is the number of dependent modules | ||
| 118 | |||
| 119 | If the type is: fail | ||
| 120 | |||
| 121 | The score is the FAIL score | ||
| 122 | |||
| 123 | =head1 AUTHOR | ||
| 124 | |||
| 125 | Apocalypse E<lt>apocal@cpan.orgE<gt> | ||
| 126 | |||
| 127 | =head1 COPYRIGHT AND LICENSE | ||
| 128 | |||
| 129 | Copyright 2010 by Apocalypse | ||
| 130 | |||
| 131 | This library is free software; you can redistribute it and/or modify | ||
| 132 | it under the same terms as Perl itself. | ||
| 133 | |||
| 134 | The full text of the license can be found in the LICENSE file included with this module. | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||