| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package CPANPLUS::Internals::Constants::Report; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 21 |  |  | 20 |  | 399 | use strict; | 
|  | 21 |  |  |  |  | 75 |  | 
|  | 20 |  |  |  |  | 716 |  | 
| 4 | 20 |  |  | 20 |  | 131 | use CPANPLUS::Error; | 
|  | 20 |  |  |  |  | 56 |  | 
|  | 22 |  |  |  |  | 1806 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 22 |  |  | 20 |  | 157 | use File::Spec; | 
|  | 22 |  |  |  |  | 54 |  | 
|  | 22 |  |  |  |  | 719 |  | 
| 7 | 76 |  |  | 20 |  | 460 | use Locale::Maketext::Simple    Class => 'CPANPLUS', Style => 'gettext'; | 
|  | 21 |  |  |  |  | 73 |  | 
|  | 21 |  |  |  |  | 142 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | require Exporter; | 
| 10 | 21 |  |  | 20 |  | 5550 | use vars    qw[$VERSION @ISA @EXPORT]; | 
|  | 22 |  |  |  |  | 68 |  | 
|  | 20 |  |  |  |  | 1272 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 20 |  |  | 20 |  | 163 | use Package::Constants; | 
|  | 20 |  |  |  |  | 68 |  | 
|  | 20 |  |  |  |  | 2977 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | ### for the version | 
| 15 |  |  |  |  |  |  | require CPANPLUS::Internals; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | $VERSION = "0.9910"; | 
| 18 |  |  |  |  |  |  | @ISA        = qw[Exporter]; | 
| 19 |  |  |  |  |  |  | @EXPORT     = Package::Constants->list( __PACKAGE__ ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | ### OS to regex map ### | 
| 22 |  |  |  |  |  |  | my %OS = ( | 
| 23 |  |  |  |  |  |  | Amiga       => 'amigaos', | 
| 24 |  |  |  |  |  |  | Atari       => 'mint', | 
| 25 |  |  |  |  |  |  | BSD         => 'bsdos|bitrig|darwin|freebsd|openbsd|netbsd', | 
| 26 |  |  |  |  |  |  | Be          => 'beos', | 
| 27 |  |  |  |  |  |  | BeOS        => 'beos', | 
| 28 |  |  |  |  |  |  | Cygwin      => 'cygwin', | 
| 29 |  |  |  |  |  |  | Darwin      => 'darwin', | 
| 30 |  |  |  |  |  |  | EBCDIC      => 'os390|os400|posix-bc|vmesa', | 
| 31 |  |  |  |  |  |  | HPUX        => 'hpux', | 
| 32 |  |  |  |  |  |  | Linux       => 'linux', | 
| 33 |  |  |  |  |  |  | MSDOS       => 'dos|os2|MSWin32|cygwin', | 
| 34 |  |  |  |  |  |  | 'bin\\d*Mac'=> 'MacOS|darwin', # binMac, bin56Mac, bin58Mac... | 
| 35 |  |  |  |  |  |  | Mac         => 'MacOS|darwin', | 
| 36 |  |  |  |  |  |  | MacPerl     => 'MacOS', | 
| 37 |  |  |  |  |  |  | MacOS       => 'MacOS|darwin', | 
| 38 |  |  |  |  |  |  | MacOSX      => 'darwin', | 
| 39 |  |  |  |  |  |  | MPE         => 'mpeix', | 
| 40 |  |  |  |  |  |  | MPEiX       => 'mpeix', | 
| 41 |  |  |  |  |  |  | OS2         => 'os2', | 
| 42 |  |  |  |  |  |  | Plan9       => 'plan9', | 
| 43 |  |  |  |  |  |  | RISCOS      => 'riscos', | 
| 44 |  |  |  |  |  |  | SGI         => 'irix', | 
| 45 |  |  |  |  |  |  | Solaris     => 'solaris', | 
| 46 |  |  |  |  |  |  | Unix        => 'aix|bsdos|bitrig|darwin|dgux|dynixptx|freebsd|'. | 
| 47 |  |  |  |  |  |  | 'linux|hpux|machten|netbsd|next|openbsd|dec_osf|'. | 
| 48 |  |  |  |  |  |  | 'svr4|sco_sv|unicos|unicosmk|solaris|sunos', | 
| 49 |  |  |  |  |  |  | VMS         => 'VMS', | 
| 50 |  |  |  |  |  |  | VOS         => 'VOS', | 
| 51 |  |  |  |  |  |  | Win32       => 'MSWin32|cygwin', | 
| 52 |  |  |  |  |  |  | Win32API    => 'MSWin32|cygwin', | 
| 53 |  |  |  |  |  |  | ); | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 20 |  |  | 20 |  | 191 | use constant GRADE_FAIL     => 'fail'; | 
|  | 20 |  |  |  |  | 80 |  | 
|  | 20 |  |  |  |  | 1458 |  | 
| 56 | 24 |  |  | 20 |  | 920 | use constant GRADE_PASS     => 'pass'; | 
|  | 24 |  |  |  |  | 78 |  | 
|  | 23 |  |  |  |  | 1156 |  | 
| 57 | 21 |  |  | 20 |  | 178 | use constant GRADE_NA       => 'na'; | 
|  | 20 |  |  |  |  | 47 |  | 
|  | 20 |  |  |  |  | 1324 |  | 
| 58 | 20 |  |  | 20 |  | 163 | use constant GRADE_UNKNOWN  => 'unknown'; | 
|  | 24 |  |  |  |  | 306 |  | 
|  | 24 |  |  |  |  | 1141 |  | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 22 |  |  |  |  | 1226 | use constant MAX_REPORT_SEND | 
| 61 | 21 |  |  | 20 |  | 128 | => 2; | 
|  | 23 |  |  |  |  | 77 |  | 
| 62 |  |  |  |  |  |  |  | 
| 63 | 20 |  |  |  |  | 2304 | use constant CPAN_TESTERS_EMAIL | 
| 64 | 21 |  |  | 20 |  | 144 | => 'cpan-testers@perl.org'; | 
|  | 20 |  |  |  |  | 54 |  | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | ### the cpan mail account for this user ### | 
| 67 |  |  |  |  |  |  | use constant CPAN_MAIL_ACCOUNT | 
| 68 |  |  |  |  |  |  | => sub { | 
| 69 | 0 | 50 |  |  |  | 0 | my $username = shift or return; | 
| 70 | 0 |  |  |  |  | 0 | return $username . '@cpan.org'; | 
| 71 | 20 |  |  | 20 |  | 165 | }; | 
|  | 20 |  |  |  |  | 73 |  | 
|  | 20 |  |  |  |  | 3981 |  | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | ### check if this module is platform specific and if we're on that | 
| 74 |  |  |  |  |  |  | ### specific platform. Alternately, the module is not platform specific | 
| 75 |  |  |  |  |  |  | ### and we're always OK to send out test results. | 
| 76 |  |  |  |  |  |  | use constant RELEVANT_TEST_RESULT | 
| 77 |  |  |  |  |  |  | => sub { | 
| 78 | 1 | 50 |  |  |  | 7 | my $mod  = shift or return; | 
| 79 | 0 |  |  |  |  | 0 | my $name = $mod->module; | 
| 80 | 0 |  |  |  |  | 0 | my $specific; | 
| 81 | 0 |  |  |  |  | 0 | for my $platform (keys %OS) { | 
| 82 | 0 | 100 |  |  |  | 0 | if( $name =~ /^$platform\b/i ) { | 
| 83 |  |  |  |  |  |  | # beware the Mac != MAC | 
| 84 | 0 | 50 | 33 |  |  | 0 | next if($platform eq 'Mac' && | 
| 85 |  |  |  |  |  |  | $name !~ /^$platform\b/); | 
| 86 | 2 |  |  |  |  | 425 | $specific++; | 
| 87 | 2 | 50 |  |  |  | 23 | return 1 if | 
| 88 |  |  |  |  |  |  | $^O =~ /^(?:$OS{$platform})$/ | 
| 89 |  |  |  |  |  |  | } | 
| 90 |  |  |  |  |  |  | }; | 
| 91 | 0 | 100 |  |  |  | 0 | return $specific ? 0 : 1; | 
| 92 | 24 |  |  | 20 |  | 891 | }; | 
|  | 24 |  |  |  |  | 518 |  | 
|  | 23 |  |  |  |  | 3581 |  | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | use constant UNSUPPORTED_OS | 
| 95 |  |  |  |  |  |  | => sub { | 
| 96 | 0 | 0 |  |  |  | 0 | my $buffer = shift or return; | 
| 97 | 2 | 50 |  |  |  | 1387 | if( $buffer =~ | 
| 98 |  |  |  |  |  |  | /No support for OS|OS unsupported/im ) { | 
| 99 | 2 |  |  |  |  | 8 | return 1; | 
| 100 |  |  |  |  |  |  | } | 
| 101 | 2 |  |  |  |  | 20 | return 0; | 
| 102 | 20 |  |  | 20 |  | 159 | }; | 
|  | 20 |  |  |  |  | 54 |  | 
|  | 20 |  |  |  |  | 3220 |  | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | use constant PERL_VERSION_TOO_LOW | 
| 105 |  |  |  |  |  |  | => sub { | 
| 106 | 2 | 100 |  |  |  | 4 | my $buffer = shift or return; | 
| 107 |  |  |  |  |  |  | # ExtUtils::MakeMaker format | 
| 108 | 2 | 50 |  |  |  | 3 | if( $buffer =~ | 
| 109 |  |  |  |  |  |  | /Perl .*? required--this is only .*?/m ) { | 
| 110 | 2 |  |  |  |  | 3 | return 1; | 
| 111 |  |  |  |  |  |  | } | 
| 112 |  |  |  |  |  |  | # Module::Build format | 
| 113 | 2 | 100 |  |  |  | 10 | if( $buffer =~ | 
| 114 |  |  |  |  |  |  | /ERROR:( perl:)? Version .*?( of perl)? is installed, but we need version >= .*?/m ) { | 
| 115 | 2 |  |  |  |  | 5 | return 1; | 
| 116 |  |  |  |  |  |  | } | 
| 117 | 0 |  |  |  |  | 0 | return 0; | 
| 118 | 22 |  |  | 20 |  | 220 | }; | 
|  | 22 |  |  |  |  | 61 |  | 
|  | 22 |  |  |  |  | 3982 |  | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | use constant NO_TESTS_DEFINED | 
| 121 |  |  |  |  |  |  | => sub { | 
| 122 | 4 | 100 |  |  |  | 70 | my $buffer = shift or return; | 
| 123 | 4 | 50 | 66 |  |  | 91 | if( $buffer =~ | 
|  |  |  | 66 |  |  |  |  | 
| 124 |  |  |  |  |  |  | /(No tests defined( for [\w:]+ extension)?\.)/ | 
| 125 |  |  |  |  |  |  | and $buffer !~ /\*\.t/m and | 
| 126 |  |  |  |  |  |  | $buffer !~ /test\.pl/m | 
| 127 |  |  |  |  |  |  | ) { | 
| 128 | 0 |  |  |  |  | 0 | return $1 | 
| 129 |  |  |  |  |  |  | } | 
| 130 |  |  |  |  |  |  |  | 
| 131 | 4 |  |  |  |  | 32 | return; | 
| 132 | 20 |  |  | 20 |  | 161 | }; | 
|  | 20 |  |  |  |  | 49 |  | 
|  | 20 |  |  |  |  | 1952 |  | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | ### what stage did the test fail? ### | 
| 135 |  |  |  |  |  |  | use constant TEST_FAIL_STAGE | 
| 136 |  |  |  |  |  |  | => sub { | 
| 137 | 0 | 50 |  |  |  | 0 | my $buffer = shift or return; | 
| 138 | 0 | 50 |  |  |  | 0 | return $buffer =~ /(MAKE [A-Z]+).*/ | 
| 139 |  |  |  |  |  |  | ? lc $1 : | 
| 140 |  |  |  |  |  |  | 'fetch'; | 
| 141 | 21 |  |  | 20 |  | 1039 | }; | 
|  | 21 |  |  |  |  | 49 |  | 
|  | 20 |  |  |  |  | 4597 |  | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | use constant MISSING_PREREQS_LIST | 
| 145 |  |  |  |  |  |  | => sub { | 
| 146 | 0 |  |  |  |  | 0 | my $buffer = shift; | 
| 147 | 1 |  |  |  |  | 2171 | my $last = ( split /\[ERROR\] .+? MAKE TEST/, $buffer )[-1]; | 
| 148 | 1 |  |  |  |  | 7 | my @list = map { s/.pm$//; s|/|::|g; $_ } | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 149 |  |  |  |  |  |  | ($last =~ | 
| 150 |  |  |  |  |  |  | m/\bCan\'t locate (\S+) in \@INC/g); | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | ### make sure every missing prereq is only | 
| 153 |  |  |  |  |  |  | ### listed once | 
| 154 | 0 |  |  |  |  | 0 | {   my %seen; | 
|  | 0 |  |  |  |  | 0 |  | 
| 155 | 0 |  |  |  |  | 0 | @list = grep { !$seen{$_}++ } @list | 
|  | 0 |  |  |  |  | 0 |  | 
| 156 |  |  |  |  |  |  | } | 
| 157 |  |  |  |  |  |  |  | 
| 158 | 2 |  |  |  |  | 4159 | return @list; | 
| 159 | 20 |  |  | 20 |  | 169 | }; | 
|  | 20 |  |  |  |  | 42 |  | 
|  | 20 |  |  |  |  | 3698 |  | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | use constant MISSING_EXTLIBS_LIST | 
| 162 |  |  |  |  |  |  | => sub { | 
| 163 | 2 |  |  |  |  | 11 | my $buffer = shift; | 
| 164 | 2 |  |  |  |  | 10 | my @list = | 
| 165 |  |  |  |  |  |  | ($buffer =~ | 
| 166 |  |  |  |  |  |  | m/No library found for -l([-\w]+)/g); | 
| 167 |  |  |  |  |  |  |  | 
| 168 | 0 |  |  |  |  | 0 | return @list; | 
| 169 | 22 |  |  | 20 |  | 179 | }; | 
|  | 22 |  |  |  |  | 54 |  | 
|  | 22 |  |  |  |  | 1882 |  | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | use constant REPORT_MESSAGE_HEADER | 
| 172 |  |  |  |  |  |  | => sub { | 
| 173 | 0 |  |  |  |  | 0 | my ($version, $author) = @_; | 
| 174 | 0 |  |  |  |  | 0 | return << "."; | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | Dear $author, | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | This is a computer-generated error report created automatically by | 
| 179 |  |  |  |  |  |  | CPANPLUS, version $version. Testers personal comments may appear | 
| 180 |  |  |  |  |  |  | at the end of this report. | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | . | 
| 183 | 20 |  |  | 20 |  | 142 | }; | 
|  | 20 |  |  |  |  | 51 |  | 
|  | 20 |  |  |  |  | 2123 |  | 
| 184 |  |  |  |  |  |  |  | 
| 185 |  |  |  |  |  |  | use constant REPORT_MESSAGE_FAIL_HEADER | 
| 186 |  |  |  |  |  |  | => sub { | 
| 187 | 0 |  |  |  |  | 0 | my($stage, $buffer) = @_; | 
| 188 | 0 |  |  |  |  | 0 | return << "."; | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | Thank you for uploading your work to CPAN.  However, it appears that | 
| 191 |  |  |  |  |  |  | there were some problems testing your distribution. | 
| 192 |  |  |  |  |  |  |  | 
| 193 |  |  |  |  |  |  | TEST RESULTS: | 
| 194 |  |  |  |  |  |  |  | 
| 195 |  |  |  |  |  |  | Below is the error stack from stage '$stage': | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | $buffer | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | . | 
| 200 | 20 |  |  | 20 |  | 184 | }; | 
|  | 20 |  |  |  |  | 54 |  | 
|  | 20 |  |  |  |  | 2205 |  | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | use constant REPORT_MESSAGE_PASS_HEADER | 
| 203 |  |  |  |  |  |  | => sub { | 
| 204 | 1 |  |  |  |  | 2094 | my($stage, $buffer) = @_; | 
| 205 | 0 |  |  |  |  | 0 | return << "."; | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | Thank you for uploading your work to CPAN.  Congratulations! | 
| 208 |  |  |  |  |  |  | All tests were successful. | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | TEST RESULTS: | 
| 211 |  |  |  |  |  |  |  | 
| 212 |  |  |  |  |  |  | Below is the error stack from stage '$stage': | 
| 213 |  |  |  |  |  |  |  | 
| 214 |  |  |  |  |  |  | $buffer | 
| 215 |  |  |  |  |  |  |  | 
| 216 |  |  |  |  |  |  | . | 
| 217 | 20 |  |  | 20 |  | 145 | }; | 
|  | 20 |  |  |  |  | 55 |  | 
|  | 20 |  |  |  |  | 4216 |  | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | use constant REPORT_MISSING_PREREQS | 
| 220 |  |  |  |  |  |  | => sub { | 
| 221 | 0 |  |  |  |  | 0 | my ($author,$email,@missing) = @_; | 
| 222 | 1 | 100 | 66 |  |  | 1157 | $author = ($author && $email) | 
| 223 |  |  |  |  |  |  | ? "$author ($email)" | 
| 224 |  |  |  |  |  |  | : 'Your Name Here'; | 
| 225 |  |  |  |  |  |  |  | 
| 226 | 0 |  |  |  |  | 0 | my $modules = join "\n", @missing; | 
| 227 |  |  |  |  |  |  | my $prereqs = join "\n", | 
| 228 | 0 |  |  |  |  | 0 | map {"\t'$_'\t=> '0',". | 
|  | 0 |  |  |  |  | 0 |  | 
| 229 |  |  |  |  |  |  | " # or a minimum working version"} | 
| 230 |  |  |  |  |  |  | @missing; | 
| 231 |  |  |  |  |  |  |  | 
| 232 | 0 |  |  |  |  | 0 | return << "."; | 
| 233 |  |  |  |  |  |  |  | 
| 234 |  |  |  |  |  |  | MISSING PREREQUISITES: | 
| 235 |  |  |  |  |  |  |  | 
| 236 |  |  |  |  |  |  | It was observed that the test suite seem to fail without these modules: | 
| 237 |  |  |  |  |  |  |  | 
| 238 |  |  |  |  |  |  | $modules | 
| 239 |  |  |  |  |  |  |  | 
| 240 |  |  |  |  |  |  | As such, adding the prerequisite module(s) to 'PREREQ_PM' in your | 
| 241 |  |  |  |  |  |  | Makefile.PL should solve this problem.  For example: | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | WriteMakefile( | 
| 244 |  |  |  |  |  |  | AUTHOR      => '$author', | 
| 245 |  |  |  |  |  |  | ... # other information | 
| 246 |  |  |  |  |  |  | PREREQ_PM   => { | 
| 247 |  |  |  |  |  |  | $prereqs | 
| 248 |  |  |  |  |  |  | } | 
| 249 |  |  |  |  |  |  | ); | 
| 250 |  |  |  |  |  |  |  | 
| 251 |  |  |  |  |  |  | Thanks! :-) | 
| 252 |  |  |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | . | 
| 254 | 20 |  |  | 20 |  | 158 | }; | 
|  | 20 |  |  |  |  | 42 |  | 
|  | 20 |  |  |  |  | 1948 |  | 
| 255 |  |  |  |  |  |  |  | 
| 256 |  |  |  |  |  |  | use constant REPORT_MISSING_TESTS | 
| 257 |  |  |  |  |  |  | => sub { | 
| 258 | 0 |  |  |  |  | 0 | return << "."; | 
| 259 |  |  |  |  |  |  | RECOMMENDATIONS: | 
| 260 |  |  |  |  |  |  |  | 
| 261 |  |  |  |  |  |  | It would be very helpful if you could include even a simple test | 
| 262 |  |  |  |  |  |  | script in the next release, so people can verify which platforms | 
| 263 |  |  |  |  |  |  | can successfully install them, as well as avoid regression bugs? | 
| 264 |  |  |  |  |  |  |  | 
| 265 |  |  |  |  |  |  | A simple 't/use.t' that says: | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | #!/usr/bin/env perl -w | 
| 268 |  |  |  |  |  |  | use strict; | 
| 269 |  |  |  |  |  |  | use Test; | 
| 270 |  |  |  |  |  |  | BEGIN { plan tests => 1 } | 
| 271 |  |  |  |  |  |  |  | 
| 272 |  |  |  |  |  |  | use Your::Module::Here; ok(1); | 
| 273 |  |  |  |  |  |  | exit; | 
| 274 |  |  |  |  |  |  | __END__ |