1 package CPANPLUS::Internals::Constants::Report;
7 use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext';
10 use vars qw[$VERSION @ISA @EXPORT];
12 use Package::Constants;
17 @EXPORT = Package::Constants->list( __PACKAGE__ );
20 require CPANPLUS::Internals;
22 ### OS to regex map ###
26 BSD => 'bsdos|darwin|freebsd|openbsd|netbsd',
31 EBCDIC => 'os390|os400|posix-bc|vmesa',
34 MSDOS => 'dos|os2|MSWin32|cygwin',
35 'bin\\d*Mac'=> 'MacOS|darwin', # binMac, bin56Mac, bin58Mac...
36 Mac => 'MacOS|darwin',
38 MacOS => 'MacOS|darwin',
47 Unix => 'aix|bsdos|darwin|dgux|dynixptx|freebsd|'.
48 'linux|hpux|machten|netbsd|next|openbsd|dec_osf|'.
49 'svr4|sco_sv|unicos|unicosmk|solaris|sunos',
52 Win32 => 'MSWin32|cygwin',
53 Win32API => 'MSWin32|cygwin',
56 use constant GRADE_FAIL => 'fail';
57 use constant GRADE_PASS => 'pass';
58 use constant GRADE_NA => 'na';
59 use constant GRADE_UNKNOWN => 'unknown';
61 use constant MAX_REPORT_SEND
64 use constant CPAN_TESTERS_EMAIL
65 => 'cpan-testers@perl.org';
67 ### the cpan mail account for this user ###
68 use constant CPAN_MAIL_ACCOUNT
70 my $username = shift or return;
71 return $username . '@cpan.org';
74 ### check if this module is platform specific and if we're on that
75 ### specific platform. Alternately, the module is not platform specific
76 ### and we're always OK to send out test results.
77 use constant RELEVANT_TEST_RESULT
79 my $mod = shift or return;
80 my $name = $mod->module;
82 for my $platform (keys %OS) {
83 if( $name =~ /\b$platform\b/i ) {
84 # beware the Mac != MAC
85 next if($platform eq 'Mac' &&
86 $name !~ /\b$platform\b/);
89 $^O =~ /^(?:$OS{$platform})$/
92 return $specific ? 0 : 1;
95 use constant UNSUPPORTED_OS
97 my $buffer = shift or return;
99 /No support for OS|OS unsupported/im ) {
105 use constant PERL_VERSION_TOO_LOW
107 my $buffer = shift or return;
108 # ExtUtils::MakeMaker format
110 /Perl .*? required--this is only .*?/m ) {
113 # Module::Build format
115 /ERROR:( perl:)? Version .*?( of perl)? is installed, but we need version >= .*?/m ) {
121 use constant NO_TESTS_DEFINED
123 my $buffer = shift or return;
125 /(No tests defined( for [\w:]+ extension)?\.)/
126 and $buffer !~ /\*\.t/m and
127 $buffer !~ /test\.pl/m
135 ### what stage did the test fail? ###
136 use constant TEST_FAIL_STAGE
138 my $buffer = shift or return;
139 return $buffer =~ /(MAKE [A-Z]+).*/
145 use constant MISSING_PREREQS_LIST
148 my @list = map { s/.pm$//; s|/|::|g; $_ }
150 m/\bCan\'t locate (\S+) in \@INC/g);
152 ### make sure every missing prereq is only
155 @list = grep { !$seen{$_}++ } @list
161 use constant MISSING_EXTLIBS_LIST
166 m/No library found for -l([-\w]+)/g);
171 use constant REPORT_MESSAGE_HEADER
173 my ($version, $author) = @_;
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.
185 use constant REPORT_MESSAGE_FAIL_HEADER
187 my($stage, $buffer) = @_;
190 Thank you for uploading your work to CPAN. However, it appears that
191 there were some problems testing your distribution.
195 Below is the error stack from stage '$stage':
202 use constant REPORT_MISSING_PREREQS
204 my ($author,$email,@missing) = @_;
205 $author = ($author && $email)
209 my $modules = join "\n", @missing;
210 my $prereqs = join "\n",
211 map {"\t'$_'\t=> '0',".
212 " # or a minimum working version"}
217 MISSING PREREQUISITES:
219 It was observed that the test suite seem to fail without these modules:
223 As such, adding the prerequisite module(s) to 'PREREQ_PM' in your
224 Makefile.PL should solve this problem. For example:
228 ... # other information
234 If you are interested in making a more flexible Makefile.PL that can
235 probe for missing dependencies and install them, ExtUtils::AutoInstall
236 at <http://search.cpan.org/dist/ExtUtils-AutoInstall/> may be
244 use constant REPORT_MISSING_TESTS
249 It would be very helpful if you could include even a simple test
250 script in the next release, so people can verify which platforms
251 can successfully install them, as well as avoid regression bugs?
253 A simple 't/use.t' that says:
255 #!/usr/bin/env perl -w
258 BEGIN { plan tests => 1 }
260 use Your::Module::Here; ok(1);
264 would be appreciated. If you are interested in making a more robust
265 test suite, please see the Test::Simple, Test::More and Test::Tutorial
266 documentation at <http://search.cpan.org/dist/Test-Simple/>.
273 use constant REPORT_LOADED_PREREQS
276 my $cb = $mod->parent;
277 my $prq = $mod->status->prereqs || {};
279 ### not every prereq may be coming from CPAN
280 ### so maybe we wont find it in our module
282 ### skip ones that cant be found in teh list
283 ### as reported in #12723
284 my @prq = grep { defined }
285 map { $cb->module_tree($_) }
289 return '' unless @prq;
291 ### some apparently, list what we loaded
295 Here is a list of prerequisites you specified and versions we
300 map { sprintf "\t%s %-30s %8s %8s\n",
303 } [' ', 'Module Name', 'Have', 'Want'],
304 map { my $want = $prq->{$_->name};
305 [ do { $_->is_uptodate(
310 $_->installed_version,
313 ### might be empty entries in there
314 } grep { defined $_ } @prq;
319 use constant REPORT_TESTS_SKIPPED
323 ******************************** NOTE ********************************
325 *** The tests for this module were skipped during this build ***
327 **********************************************************************
332 use constant REPORT_MESSAGE_FOOTER
336 ******************************** NOTE ********************************
337 The comments above are created mechanically, possibly without manual
338 checking by the sender. As there are many people performing automatic
339 tests on each upload to CPAN, it is likely that you will receive
340 identical messages about the same problem.
342 If you believe that the message is mistaken, please reply to the first
343 one with correction and/or additional informations, and do not take
344 it personally. We appreciate your patience. :)
345 **********************************************************************
355 # c-indentation-style: bsd
357 # indent-tabs-mode: nil
359 # vim: expandtab shiftwidth=4: