1 | =head1 NAME |
1 | =head1 NAME |
2 | |
2 | |
3 | Canary::Stability - to be done |
3 | Canary::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 | |
11 | This is just a placeholder module, to be filled in later. |
12 | This module is used by Schmorp's modules during configuration stage to |
|
|
13 | test the installed perl for compatibility with his modules. |
12 | |
14 | |
13 | =over 4 |
15 | It's not, at this stage, meant as a tool for other module authors, |
|
|
16 | although in principle nothing prevents them from subscribing to the same |
|
|
17 | ideas. |
|
|
18 | |
|
|
19 | See the F<Makefile.PL> in L<Coro> or L<AnyEvent> for usage examples. |
14 | |
20 | |
15 | =cut |
21 | =cut |
16 | |
22 | |
17 | package Canary::Stability; |
23 | package Canary::Stability; |
18 | |
24 | |
19 | BEGIN { |
25 | BEGIN { |
20 | $VERSION = 2001; # the year perl was accomodating enough to developers to foster weird ideas such as Coro |
26 | $VERSION = 2006; |
21 | } |
27 | } |
22 | |
28 | |
23 | sub sgr { |
29 | sub sgr { |
24 | # we just assume ANSI almost everywhere |
30 | # we just assume ANSI almost everywhere |
25 | |
|
|
26 | # red 31, yellow 33, green 32 |
31 | # red 31, yellow 33, green 32 |
|
|
32 | local $| = 1; |
27 | |
33 | |
28 | $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
34 | $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
29 | 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}) |
30 | and print "\e[$_[0]m"; |
36 | and print "\e[$_[0]m"; |
31 | } |
37 | } |
… | |
… | |
41 | if ($minvers > $VERSION) { |
47 | if ($minvers > $VERSION) { |
42 | sgr 33; |
48 | sgr 33; |
43 | print <<EOF; |
49 | print <<EOF; |
44 | |
50 | |
45 | *** |
51 | *** |
46 | *** The stability canary says: (nothing, he died of old age). |
52 | *** The stability canary says: (nothing, it died of old age). |
47 | *** |
53 | *** |
48 | *** Your Canary::Stability module (used by $distname) is too old. |
54 | *** Your Canary::Stability module (used by $distname) is too old. |
49 | *** This is not a fatal problem - while you might want to upgrade to version |
55 | *** This is not a fatal problem - while you might want to upgrade to version |
50 | *** $minvers (currently installed version: $VERSION) to get better support |
56 | *** $minvers (currently installed version: $VERSION) to get better support |
51 | *** status testing, you might also not want to care at all, and all will |
57 | *** status testing, you might also not want to care at all, and all will |
… | |
… | |
58 | |
64 | |
59 | sgr 33; |
65 | sgr 33; |
60 | print <<EOF; |
66 | print <<EOF; |
61 | |
67 | |
62 | *** |
68 | *** |
63 | *** The stability canary says: chirp... (it seems a bit unhappy). |
69 | *** The stability canary says: chirp (it seems concerned about something). |
64 | *** |
70 | *** |
65 | *** Your perl version ($]) is older than the $distname distribution |
71 | *** Your perl version ($]) is older than the $distname distribution |
66 | *** likes ($minperl). This is not a fatal problem - the module might work |
72 | *** likes ($minperl). This is not a fatal problem - the module might work |
67 | *** well with your version of perl, but it does mean the author likely |
73 | *** well with your version of perl, but it does mean the author likely |
68 | *** won't do anything to make it wokr if it breaks. |
74 | *** won't do anything to make it work if it breaks. |
69 | *** |
75 | *** |
70 | |
76 | |
71 | EOF |
77 | EOF |
72 | } elsif (defined $Internals::StabilityBranchVersion) { |
78 | } elsif (defined $Internals::StabilityBranchVersion) { |
73 | # note to people studying this modules sources: |
79 | # note to people studying this modules sources: |
… | |
… | |
84 | *** All should be well, and if it isn't, you should report this as a bug |
90 | *** All should be well, and if it isn't, you should report this as a bug |
85 | *** to the $distname author. |
91 | *** to the $distname author. |
86 | *** |
92 | *** |
87 | |
93 | |
88 | EOF |
94 | EOF |
89 | } elsif ($] <= 4.020) { |
95 | } elsif ($] < 5.021) { |
90 | sgr 32; |
96 | #sgr 32; |
91 | print <<EOF; |
97 | print <<EOF; |
92 | |
98 | |
93 | *** |
99 | *** |
94 | *** The stability canary says: chirp! chirp! (it seems to be quite happy) |
100 | *** The stability canary says: chirp! chirp! (it seems to be quite happy) |
95 | *** |
101 | *** |
… | |
… | |
137 | *** |
143 | *** |
138 | *** How can I skip this prompt on automated installs? |
144 | *** How can I skip this prompt on automated installs? |
139 | *** Set PERL_CANARY_STABILITY_NOPROMPT=1 in your environment. |
145 | *** Set PERL_CANARY_STABILITY_NOPROMPT=1 in your environment. |
140 | *** More info is in the Canary::Stability manpage. |
146 | *** More info is in the Canary::Stability manpage. |
141 | *** |
147 | *** |
142 | *** Long version of this FAQ: http://stabilityperl.schmorp.de/faq.html |
148 | *** Long version of this FAQ: http://stableperl.schmorp.de/faq.html |
143 | *** Stability Branch homepage: http://stabilityperl.schmorp.de/ |
149 | *** Stability Branch homepage: http://stableperl.schmorp.de/ |
144 | *** |
150 | *** |
145 | |
151 | |
146 | EOF |
152 | EOF |
147 | |
153 | |
148 | unless ($ENV{PERL_CANARY_STABILITY_NOPROMPT}) { |
154 | unless ($ENV{PERL_CANARY_STABILITY_NOPROMPT}) { |
… | |
… | |
179 | =back |
185 | =back |
180 | |
186 | |
181 | =head1 AUTHOR |
187 | =head1 AUTHOR |
182 | |
188 | |
183 | Marc Lehmann <schmorp@schmorp.de> |
189 | Marc Lehmann <schmorp@schmorp.de> |
184 | http://home.schmorp.de/ |
190 | http://software.schmorp.de/pkg/Canary-Stability.html |
185 | |
191 | |
186 | =cut |
192 | =cut |
187 | |
193 | |
188 | 1 |
194 | 1 |
189 | |
195 | |