ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Canary-Stability/Stability.pm
(Generate patch)

Comparing Canary-Stability/Stability.pm (file contents):
Revision 1.3 by root, Thu Jun 4 23:49:11 2015 UTC vs.
Revision 1.10 by root, Mon Apr 22 10:40:01 2019 UTC

1=head1 NAME 1=head1 NAME
2 2
3Canary::Stability - to be done 3Canary::Stability - canary to check perl compatibility for schmorp's modules
4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use Canary::Stability; 7 # in Makefile.PL
8 use Canary::Stability DISTNAME => 2001, MINIMUM_PERL_VERSION;
8 9
9=head1 DESCRIPTION 10=head1 DESCRIPTION
10 11
11This is just a placeholder module, to be filled in later. 12This module is used by Schmorp's modules during configuration stage to
13test the installed perl for compatibility with his modules.
12 14
13=over 4 15It's not, at this stage, meant as a tool for other module authors,
16although in principle nothing prevents them from subscribing to the same
17ideas.
18
19See the F<Makefile.PL> in L<Coro> or L<AnyEvent> for usage examples.
14 20
15=cut 21=cut
16 22
17package Canary::Stability; 23package Canary::Stability;
18 24
19BEGIN { 25BEGIN {
20 $VERSION = 2001; 26 $VERSION = 2013;
21} 27}
22 28
23sub sgr { 29sub sgr {
24 # we just assume ANSI almost everywhere 30 # we just assume ANSI almost everywhere
25 # red 31, yellow 33, green 32 31 # red 31, yellow 33, green 32
32 local $| = 1;
26 33
27 $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 34 $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0
28 and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR}) 35 and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR})
29 and print "\e[$_[0]m"; 36 and print "\e[$_[0]m";
30} 37}
35 $ENV{PERL_CANARY_STABILITY_DISABLE} 42 $ENV{PERL_CANARY_STABILITY_DISABLE}
36 and return; 43 and return;
37 44
38 $minperl ||= 5.008002; 45 $minperl ||= 5.008002;
39 46
47 print <<EOF;
48
49***
50*** Canary::Stability COMPATIBILITY AND SUPPORT CHECK
51*** =================================================
52***
53*** Hi!
54***
55*** I do my best to provide predictable and reliable software.
56***
57*** However, in recent releases, P5P (who maintain perl) have been
58*** introducing regressions that are sometimes subtle and at other times
59*** catastrophic, often for personal preferences with little or no concern
60*** for existing code, most notably CPAN.
61***
62*** For this reason, it has become very hard for me to maintain the level
63*** of reliability and support I have committed myself to in the past, at
64*** least with some perl versions: I simply can't keep up working around new
65*** bugs or gratituous incompatibilities, and in turn you might suffer from
66*** unanticipated problems.
67***
68*** Therefore I have introduced a support and compatibility check, the results
69*** of which follow below, together with a FAQ and some recommendations.
70***
71*** This check is just to let you know that there might be a risk, so you can
72*** make judgement calls on how to proceed - it will not keep the module from
73*** installing or working.
74***
75EOF
76
40 if ($minvers > $VERSION) { 77 if ($minvers > $VERSION) {
41 sgr 33; 78 sgr 33;
42 print <<EOF; 79 print <<EOF;
43
44***
45*** The stability canary says: (nothing, it died of old age). 80*** The stability canary says: (nothing, it died of old age).
46*** 81***
47*** Your Canary::Stability module (used by $distname) is too old. 82*** Your Canary::Stability module (used by $distname) is too old.
48*** This is not a fatal problem - while you might want to upgrade to version 83*** This is not a fatal problem - while you might want to upgrade to version
49*** $minvers (currently installed version: $VERSION) to get better support 84*** $minvers (currently installed version: $VERSION) to get better support
50*** status testing, you might also not want to care at all, and all will 85*** status testing, you might also not want to care at all, and all will
51*** be well as long $distname works well enough for you, as the stability 86*** be well as long $distname works well enough for you, as the stability
52*** canary is only used when installing the distribution. 87*** canary is only used when installing the distribution.
53*** 88***
54
55EOF 89EOF
56 } elsif ($] < $minperl) { 90 } elsif ($] < $minperl) {
57 91
58 sgr 33; 92 sgr 33;
59 print <<EOF; 93 print <<EOF;
60
61***
62*** The stability canary says: chirp (it seems concerned about something). 94*** The stability canary says: chirp (it seems concerned about something).
63*** 95***
64*** Your perl version ($]) is older than the $distname distribution 96*** Your perl version ($]) is older than the $distname distribution
65*** likes ($minperl). This is not a fatal problem - the module might work 97*** likes ($minperl). This is not a fatal problem - the module might work
66*** well with your version of perl, but it does mean the author likely 98*** well with your version of perl, but it does mean the author likely
67*** won't do anything to make it work if it breaks. 99*** won't do anything to make it work if it breaks.
68*** 100***
69
70EOF 101EOF
102
103 if ($ENV{AUTOMATED_TESTING}) {
104 print <<EOF;
105*** Since this is an AUTOMATED_TESTING environment, the stability canary
106*** decided to fail cleanly here, rather than to generate a false test
107*** result.
108***
109EOF
110 exit 0;
111 }
112
71 } elsif (defined $Internals::StabilityBranchVersion) { 113 } elsif (defined $Internals::StabilityBranchVersion) {
72 # note to people studying this modules sources: 114 # note to people studying this modules sources:
73 # the above test is not considered a clean or stable way to 115 # the above test is not considered a clean or stable way to
74 # test for the stability branch. 116 # test for the stability branch.
75 117
76 sgr 32; 118 sgr 32;
77 print <<EOF; 119 print <<EOF;
78
79***
80*** The stability canary says: chirp! chirp! (it seems to be quite excited) 120*** The stability canary says: chirp! chirp! (it seems to be quite excited)
81*** 121***
82*** It seems you are running schmorp's stability branch of perl. 122*** It seems you are running schmorp's stability branch of perl.
83*** All should be well, and if it isn't, you should report this as a bug 123*** All should be well, and if it isn't, you should report this as a bug
84*** to the $distname author. 124*** to the $distname author.
85*** 125***
86
87EOF 126EOF
88 } elsif ($] <= 5.020) { 127 } elsif ($] < 5.021) {
89 #sgr 32; 128 #sgr 32;
90 print <<EOF; 129 print <<EOF;
91
92***
93*** The stability canary says: chirp! chirp! (it seems to be quite happy) 130*** The stability canary says: chirp! chirp! (it seems to be quite happy)
94*** 131***
95*** Your version of perl ($]) is quite supported by $distname, nothing 132*** Your version of perl ($]) is quite supported by $distname, nothing
96*** else to be said, hope it comes in handy. 133*** else to be said, hope it comes in handy.
97*** 134***
98
99EOF 135EOF
100 } else { 136 } else {
101 sgr 31; 137 sgr 31;
102 print <<EOF; 138 print <<EOF;
103
104***
105*** The stability canary says: (nothing, it was driven away by harsh weather) 139*** The stability canary says: (nothing, it was driven away by harsh weather)
106*** 140***
107*** It seems you are running perl version $], likely the "official" or 141*** It seems you are running perl version $], likely the "official" or
108*** "standard" version. While there is nothing wrong with doing that, 142*** "standard" version. While there is nothing wrong with doing that,
109*** standard perl versions 5.022 and up are not supported by $distname. 143*** standard perl versions 5.022 and up are not supported by $distname.
114*** If everything works fine, you can ignore this message. 148*** If everything works fine, you can ignore this message.
115*** 149***
116EOF 150EOF
117 sgr 0; 151 sgr 0;
118 print <<EOF; 152 print <<EOF;
153***
119*** Stability canary mini-FAQ: 154*** Stability canary mini-FAQ:
120*** 155***
121*** Do I need to do anything? 156*** Do I need to do anything?
122*** With luck, no. While some distributions are known to fail 157*** With luck, no. While some distributions are known to fail
123*** already, most should probably work. This message is here 158*** already, most should probably work. This message is here
136*** 171***
137*** How can I skip this prompt on automated installs? 172*** How can I skip this prompt on automated installs?
138*** Set PERL_CANARY_STABILITY_NOPROMPT=1 in your environment. 173*** Set PERL_CANARY_STABILITY_NOPROMPT=1 in your environment.
139*** More info is in the Canary::Stability manpage. 174*** More info is in the Canary::Stability manpage.
140*** 175***
141*** Long version of this FAQ: http://stabilityperl.schmorp.de/faq.html 176*** Long version of this FAQ: http://stableperl.schmorp.de/faq.html
142*** Stability Branch homepage: http://stabilityperl.schmorp.de/ 177*** Stability Branch homepage: http://stableperl.schmorp.de/
143*** 178***
144 179
145EOF 180EOF
146 181
147 unless ($ENV{PERL_CANARY_STABILITY_NOPROMPT}) { 182 unless ($ENV{PERL_CANARY_STABILITY_NOPROMPT}) {
173 208
174=item C<PERL_CANARY_STABILITY_DISABLE=1> 209=item C<PERL_CANARY_STABILITY_DISABLE=1>
175 210
176Disable this modules functionality completely. 211Disable this modules functionality completely.
177 212
213=item C<AUTOMATED_TESTING=1>
214
215When this variable is set to a true value and the perl minimum version
216requirement is not met, the module will exit, which should skip testing
217under automated testing environments.
218
219This is done to avoid false failure or success reports when the chances of
220success are already quite low and the failures are not supported by the
221author.
222
178=back 223=back
179 224
180=head1 AUTHOR 225=head1 AUTHOR
181 226
182 Marc Lehmann <schmorp@schmorp.de> 227 Marc Lehmann <schmorp@schmorp.de>
183 http://home.schmorp.de/ 228 http://software.schmorp.de/pkg/Canary-Stability.html
184 229
185=cut 230=cut
186 231
1871 2321
188 233

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines