1 |
root |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
|
|
Canary::Stability - to be done |
4 |
|
|
|
5 |
|
|
=head1 SYNOPSIS |
6 |
|
|
|
7 |
|
|
use Canary::Stability; |
8 |
|
|
|
9 |
|
|
=head1 DESCRIPTION |
10 |
|
|
|
11 |
root |
1.2 |
This is just a placeholder module, to be filled in later. |
12 |
root |
1.1 |
|
13 |
|
|
=over 4 |
14 |
|
|
|
15 |
|
|
=cut |
16 |
|
|
|
17 |
|
|
package Canary::Stability; |
18 |
|
|
|
19 |
|
|
BEGIN { |
20 |
root |
1.3 |
$VERSION = 2001; |
21 |
root |
1.2 |
} |
22 |
|
|
|
23 |
|
|
sub sgr { |
24 |
|
|
# we just assume ANSI almost everywhere |
25 |
|
|
# red 31, yellow 33, green 32 |
26 |
|
|
|
27 |
|
|
$ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
28 |
|
|
and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR}) |
29 |
|
|
and print "\e[$_[0]m"; |
30 |
root |
1.1 |
} |
31 |
|
|
|
32 |
|
|
sub import { |
33 |
root |
1.2 |
my (undef, $distname, $minvers, $minperl) = @_; |
34 |
|
|
|
35 |
|
|
$ENV{PERL_CANARY_STABILITY_DISABLE} |
36 |
|
|
and return; |
37 |
|
|
|
38 |
|
|
$minperl ||= 5.008002; |
39 |
|
|
|
40 |
|
|
if ($minvers > $VERSION) { |
41 |
|
|
sgr 33; |
42 |
|
|
print <<EOF; |
43 |
|
|
|
44 |
|
|
*** |
45 |
root |
1.3 |
*** The stability canary says: (nothing, it died of old age). |
46 |
root |
1.2 |
*** |
47 |
|
|
*** 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 |
49 |
|
|
*** $minvers (currently installed version: $VERSION) to get better support |
50 |
|
|
*** 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 |
52 |
|
|
*** canary is only used when installing the distribution. |
53 |
|
|
*** |
54 |
|
|
|
55 |
|
|
EOF |
56 |
|
|
} elsif ($] < $minperl) { |
57 |
|
|
|
58 |
|
|
sgr 33; |
59 |
|
|
print <<EOF; |
60 |
|
|
|
61 |
|
|
*** |
62 |
root |
1.3 |
*** The stability canary says: chirp (it seems concerned about something). |
63 |
root |
1.2 |
*** |
64 |
|
|
*** Your perl version ($]) is older than the $distname distribution |
65 |
|
|
*** 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 |
67 |
root |
1.3 |
*** won't do anything to make it work if it breaks. |
68 |
root |
1.2 |
*** |
69 |
|
|
|
70 |
|
|
EOF |
71 |
|
|
} elsif (defined $Internals::StabilityBranchVersion) { |
72 |
|
|
# note to people studying this modules sources: |
73 |
|
|
# the above test is not considered a clean or stable way to |
74 |
|
|
# test for the stability branch. |
75 |
|
|
|
76 |
|
|
sgr 32; |
77 |
|
|
print <<EOF; |
78 |
|
|
|
79 |
|
|
*** |
80 |
|
|
*** The stability canary says: chirp! chirp! (it seems to be quite excited) |
81 |
|
|
*** |
82 |
|
|
*** 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 |
84 |
|
|
*** to the $distname author. |
85 |
|
|
*** |
86 |
|
|
|
87 |
|
|
EOF |
88 |
root |
1.3 |
} elsif ($] <= 5.020) { |
89 |
|
|
#sgr 32; |
90 |
root |
1.2 |
print <<EOF; |
91 |
|
|
|
92 |
|
|
*** |
93 |
|
|
*** The stability canary says: chirp! chirp! (it seems to be quite happy) |
94 |
|
|
*** |
95 |
|
|
*** Your version of perl ($]) is quite supported by $distname, nothing |
96 |
|
|
*** else to be said, hope it comes in handy. |
97 |
|
|
*** |
98 |
|
|
|
99 |
|
|
EOF |
100 |
|
|
} else { |
101 |
|
|
sgr 31; |
102 |
|
|
print <<EOF; |
103 |
|
|
|
104 |
|
|
*** |
105 |
|
|
*** The stability canary says: (nothing, it was driven away by harsh weather) |
106 |
|
|
*** |
107 |
|
|
*** It seems you are running perl version $], likely the "official" or |
108 |
|
|
*** "standard" version. While there is nothing wrong with doing that, |
109 |
|
|
*** standard perl versions 5.022 and up are not supported by $distname. |
110 |
|
|
*** While this might be fatal, it might also be all right - if you run into |
111 |
|
|
*** problems, you might want to downgrade your perl or switch to the |
112 |
|
|
*** stability branch. |
113 |
|
|
*** |
114 |
|
|
*** If everything works fine, you can ignore this message. |
115 |
|
|
*** |
116 |
|
|
EOF |
117 |
|
|
sgr 0; |
118 |
|
|
print <<EOF; |
119 |
|
|
*** Stability canary mini-FAQ: |
120 |
|
|
*** |
121 |
|
|
*** Do I need to do anything? |
122 |
|
|
*** With luck, no. While some distributions are known to fail |
123 |
|
|
*** already, most should probably work. This message is here |
124 |
|
|
*** to alert you that your perl is not supported by $distname, |
125 |
|
|
*** and if things go wrong, you either need to downgrade, or |
126 |
|
|
*** sidegrade to the stability variant of your perl version, |
127 |
|
|
*** or simply live with the consequences. |
128 |
|
|
*** |
129 |
|
|
*** What is this canary thing? |
130 |
|
|
*** It's purpose is to check support status of $distname with |
131 |
|
|
*** respect to your perl version. |
132 |
|
|
*** |
133 |
|
|
*** What is this "stability branch"? |
134 |
|
|
*** It's a branch or fork of the official perl, by schmorp, to |
135 |
|
|
*** improve stability and compatibility with existing modules. |
136 |
|
|
*** |
137 |
|
|
*** How can I skip this prompt on automated installs? |
138 |
|
|
*** Set PERL_CANARY_STABILITY_NOPROMPT=1 in your environment. |
139 |
|
|
*** More info is in the Canary::Stability manpage. |
140 |
|
|
*** |
141 |
|
|
*** Long version of this FAQ: http://stabilityperl.schmorp.de/faq.html |
142 |
|
|
*** Stability Branch homepage: http://stabilityperl.schmorp.de/ |
143 |
|
|
*** |
144 |
|
|
|
145 |
|
|
EOF |
146 |
|
|
|
147 |
|
|
unless ($ENV{PERL_CANARY_STABILITY_NOPROMPT}) { |
148 |
|
|
require ExtUtils::MakeMaker; |
149 |
|
|
|
150 |
|
|
ExtUtils::MakeMaker::prompt ("Continue anyways? ", "y") =~ /^y/i |
151 |
|
|
or die "FATAL: User aborted configuration of $distname.\n"; |
152 |
|
|
} |
153 |
|
|
} |
154 |
|
|
|
155 |
|
|
sgr 0; |
156 |
root |
1.1 |
} |
157 |
|
|
|
158 |
root |
1.2 |
=head1 ENVIRONMENT VARIABLES |
159 |
|
|
|
160 |
|
|
=over 4 |
161 |
|
|
|
162 |
|
|
=item C<PERL_CANARY_STABILITY_NOPROMPT=1> |
163 |
|
|
|
164 |
|
|
Do not prompt the user on alert messages. |
165 |
|
|
|
166 |
|
|
=item C<PERL_CANARY_STABILITY_COLOUR=0> |
167 |
|
|
|
168 |
|
|
Disable use of colour. |
169 |
|
|
|
170 |
|
|
=item C<PERL_CANARY_STABILITY_COLOUR=1> |
171 |
|
|
|
172 |
|
|
Force use of colour. |
173 |
|
|
|
174 |
|
|
=item C<PERL_CANARY_STABILITY_DISABLE=1> |
175 |
|
|
|
176 |
|
|
Disable this modules functionality completely. |
177 |
|
|
|
178 |
|
|
=back |
179 |
|
|
|
180 |
root |
1.1 |
=head1 AUTHOR |
181 |
|
|
|
182 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
183 |
|
|
http://home.schmorp.de/ |
184 |
|
|
|
185 |
|
|
=cut |
186 |
|
|
|
187 |
|
|
1 |
188 |
|
|
|