1 |
root |
1.7 |
#! perl-000 |
2 |
root |
1.1 |
|
3 |
root |
1.15 |
our $VERSION = '3.72'; |
4 |
root |
1.14 |
|
5 |
root |
1.1 |
open STDOUT, ">$ARGV[0]~" |
6 |
|
|
or die "$ARGV[0]~: $!"; |
7 |
|
|
|
8 |
root |
1.13 |
our ($WARN, $H, %H); |
9 |
root |
1.1 |
|
10 |
|
|
use utf8; |
11 |
|
|
use strict qw(subs vars); |
12 |
|
|
|
13 |
root |
1.10 |
BEGIN { |
14 |
|
|
if ($] >= 5.010) { |
15 |
|
|
require feature; |
16 |
|
|
feature->import (qw(say state switch)); |
17 |
|
|
} |
18 |
|
|
if ($] >= 5.012) { |
19 |
|
|
feature->import (qw(unicode_strings)); |
20 |
|
|
} |
21 |
|
|
if ($] >= 5.016) { |
22 |
|
|
feature->import (qw(current_sub fc evalbytes)); |
23 |
|
|
feature->unimport (qw(array_base)); |
24 |
|
|
} |
25 |
|
|
} |
26 |
|
|
|
27 |
root |
1.1 |
no warnings; |
28 |
root |
1.4 |
use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype |
29 |
root |
1.7 |
inplace io pipe unpack deprecated glob digit printf |
30 |
root |
1.2 |
layer reserved taint closure semicolon); |
31 |
root |
1.1 |
no warnings qw(exec newline unopened); |
32 |
|
|
|
33 |
|
|
BEGIN { |
34 |
root |
1.13 |
$H = $^H; |
35 |
|
|
$WARN = ${^WARNING_BITS}; |
36 |
root |
1.10 |
%H = %^H; |
37 |
root |
1.1 |
} |
38 |
|
|
|
39 |
|
|
while (<DATA>) { |
40 |
|
|
if (/^IMPORT/) { |
41 |
|
|
print " # use warnings\n"; |
42 |
|
|
printf " \${^WARNING_BITS} ^= \${^WARNING_BITS} ^ \"%s\";\n", |
43 |
|
|
join "", map "\\x$_", unpack "(H2)*", $WARN; |
44 |
root |
1.10 |
print " # use strict, use utf8; use feature;\n"; |
45 |
root |
1.1 |
printf " \$^H |= 0x%x;\n", $H; |
46 |
root |
1.10 |
|
47 |
|
|
if (my @features = grep /^feature_/, keys %H) { |
48 |
|
|
print " \@^H{qw(@features)} = (1) x ", (scalar @features), ";\n"; |
49 |
|
|
} |
50 |
root |
1.14 |
} elsif (/^VERSION/) { |
51 |
|
|
print "our \$VERSION = $VERSION;\n"; |
52 |
root |
1.1 |
} else { |
53 |
|
|
print; |
54 |
|
|
} |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
close STDOUT; |
58 |
|
|
rename "$ARGV[0]~", $ARGV[0]; |
59 |
|
|
|
60 |
|
|
__DATA__ |
61 |
|
|
package common::sense; |
62 |
|
|
|
63 |
root |
1.14 |
VERSION |
64 |
root |
1.1 |
|
65 |
|
|
# overload should be included |
66 |
|
|
|
67 |
|
|
sub import { |
68 |
root |
1.10 |
local $^W; # work around perl 5.16 spewing out warnings for next statement |
69 |
root |
1.1 |
IMPORT |
70 |
|
|
} |
71 |
|
|
|
72 |
root |
1.13 |
1 |