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. |
|
|
14 | |
|
|
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. |
12 | |
20 | |
13 | =over 4 |
21 | =over 4 |
14 | |
22 | |
15 | =cut |
23 | =cut |
16 | |
24 | |
17 | package Canary::Stability; |
25 | package Canary::Stability; |
18 | |
26 | |
19 | BEGIN { |
27 | BEGIN { |
20 | $VERSION = 2001; # the year perl was accomodating enough to developers to foster weird ideas such as Coro |
28 | $VERSION = 2001; |
21 | } |
29 | } |
22 | |
30 | |
23 | sub sgr { |
31 | sub sgr { |
24 | # we just assume ANSI almost everywhere |
32 | # we just assume ANSI almost everywhere |
25 | |
|
|
26 | # red 31, yellow 33, green 32 |
33 | # red 31, yellow 33, green 32 |
27 | |
34 | |
28 | $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
35 | $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
29 | and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR}) |
36 | and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR}) |
30 | and print "\e[$_[0]m"; |
37 | and print "\e[$_[0]m"; |
… | |
… | |
41 | if ($minvers > $VERSION) { |
48 | if ($minvers > $VERSION) { |
42 | sgr 33; |
49 | sgr 33; |
43 | print <<EOF; |
50 | print <<EOF; |
44 | |
51 | |
45 | *** |
52 | *** |
46 | *** The stability canary says: (nothing, he died of old age). |
53 | *** The stability canary says: (nothing, it died of old age). |
47 | *** |
54 | *** |
48 | *** Your Canary::Stability module (used by $distname) is too old. |
55 | *** 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 |
56 | *** This is not a fatal problem - while you might want to upgrade to version |
50 | *** $minvers (currently installed version: $VERSION) to get better support |
57 | *** $minvers (currently installed version: $VERSION) to get better support |
51 | *** status testing, you might also not want to care at all, and all will |
58 | *** status testing, you might also not want to care at all, and all will |
… | |
… | |
58 | |
65 | |
59 | sgr 33; |
66 | sgr 33; |
60 | print <<EOF; |
67 | print <<EOF; |
61 | |
68 | |
62 | *** |
69 | *** |
63 | *** The stability canary says: chirp... (it seems a bit unhappy). |
70 | *** The stability canary says: chirp (it seems concerned about something). |
64 | *** |
71 | *** |
65 | *** Your perl version ($]) is older than the $distname distribution |
72 | *** Your perl version ($]) is older than the $distname distribution |
66 | *** likes ($minperl). This is not a fatal problem - the module might work |
73 | *** 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 |
74 | *** 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. |
75 | *** won't do anything to make it work if it breaks. |
69 | *** |
76 | *** |
70 | |
77 | |
71 | EOF |
78 | EOF |
72 | } elsif (defined $Internals::StabilityBranchVersion) { |
79 | } elsif (defined $Internals::StabilityBranchVersion) { |
73 | # note to people studying this modules sources: |
80 | # note to people studying this modules sources: |
… | |
… | |
84 | *** All should be well, and if it isn't, you should report this as a bug |
91 | *** All should be well, and if it isn't, you should report this as a bug |
85 | *** to the $distname author. |
92 | *** to the $distname author. |
86 | *** |
93 | *** |
87 | |
94 | |
88 | EOF |
95 | EOF |
89 | } elsif ($] <= 4.020) { |
96 | } elsif ($] <= 5.020) { |
90 | sgr 32; |
97 | #sgr 32; |
91 | print <<EOF; |
98 | print <<EOF; |
92 | |
99 | |
93 | *** |
100 | *** |
94 | *** The stability canary says: chirp! chirp! (it seems to be quite happy) |
101 | *** The stability canary says: chirp! chirp! (it seems to be quite happy) |
95 | *** |
102 | *** |