1 |
#! perl-000 |
2 |
|
3 |
our $VERSION = '3.73'; |
4 |
|
5 |
open STDOUT, ">$ARGV[0]~" |
6 |
or die "$ARGV[0]~: $!"; |
7 |
|
8 |
our ($WARN, $H, %H); |
9 |
|
10 |
use utf8; |
11 |
use strict qw(subs vars); |
12 |
|
13 |
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 |
no warnings; |
28 |
use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype |
29 |
inplace io pipe unpack glob digit printf |
30 |
layer reserved taint closure semicolon); |
31 |
no warnings qw(exec newline unopened); |
32 |
|
33 |
BEGIN { |
34 |
$H = $^H; |
35 |
$WARN = ${^WARNING_BITS}; |
36 |
%H = %^H; |
37 |
} |
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 |
print " # use strict, use utf8; use feature;\n"; |
45 |
printf " \$^H |= 0x%x;\n", $H; |
46 |
|
47 |
if (my @features = grep /^feature_/, keys %H) { |
48 |
print " \@^H{qw(@features)} = (1) x ", (scalar @features), ";\n"; |
49 |
} |
50 |
} elsif (/^VERSION/) { |
51 |
print "our \$VERSION = $VERSION;\n"; |
52 |
} else { |
53 |
print; |
54 |
} |
55 |
} |
56 |
|
57 |
close STDOUT; |
58 |
rename "$ARGV[0]~", $ARGV[0]; |
59 |
|
60 |
__DATA__ |
61 |
package common::sense; |
62 |
|
63 |
VERSION |
64 |
|
65 |
# overload should be included |
66 |
|
67 |
sub import { |
68 |
local $^W; # work around perl 5.16 spewing out warnings for next statement |
69 |
IMPORT |
70 |
} |
71 |
|
72 |
1 |