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;
15 require CPANPLUS::Internals;
17 $VERSION = $CPANPLUS::Internals::VERSION = $CPANPLUS::Internals::VERSION;
19 @EXPORT = Package::Constants->list( __PACKAGE__ );
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
239 use constant REPORT_MISSING_TESTS
244 It would be very helpful if you could include even a simple test
245 script in the next release, so people can verify which platforms
246 can successfully install them, as well as avoid regression bugs?
248 A simple 't/use.t' that says:
250 #!/usr/bin/env perl -w
253 BEGIN { plan tests => 1 }
255 use Your::Module::Here; ok(1);
259 would be appreciated. If you are interested in making a more robust
260 test suite, please see the Test::Simple, Test::More and Test::Tutorial
261 documentation at <http://search.cpan.org/dist/Test-Simple/>.
268 use constant REPORT_LOADED_PREREQS
271 my $cb = $mod->parent;
272 my $prq = $mod->status->prereqs || {};
274 ### not every prereq may be coming from CPAN
275 ### so maybe we wont find it in our module
277 ### skip ones that cant be found in teh list
278 ### as reported in #12723
279 my @prq = grep { defined }
280 map { $cb->module_tree($_) }
284 return '' unless @prq;
286 ### some apparently, list what we loaded
290 Here is a list of prerequisites you specified and versions we
295 map { sprintf "\t%s %-30s %8s %8s\n",
298 } [' ', 'Module Name', 'Have', 'Want'],
299 map { my $want = $prq->{$_->name};
300 [ do { $_->is_uptodate(
305 $_->installed_version,
308 ### might be empty entries in there
309 } grep { defined $_ } @prq;
314 use constant REPORT_TESTS_SKIPPED
318 ******************************** NOTE ********************************
320 *** The tests for this module were skipped during this build ***
322 **********************************************************************
327 use constant REPORT_MESSAGE_FOOTER
331 ******************************** NOTE ********************************
332 The comments above are created mechanically, possibly without manual
333 checking by the sender. As there are many people performing automatic
334 tests on each upload to CPAN, it is likely that you will receive
335 identical messages about the same problem.
337 If you believe that the message is mistaken, please reply to the first
338 one with correction and/or additional informations, and do not take
339 it personally. We appreciate your patience. :)
340 **********************************************************************
350 # c-indentation-style: bsd
352 # indent-tabs-mode: nil
354 # vim: expandtab shiftwidth=4: