1 |
root |
1.7 |
#! perl-000 |
2 |
root |
1.1 |
|
3 |
root |
1.17 |
our $VERSION = 3.74; |
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 |
root |
1.17 |
|
26 |
root |
1.10 |
} |
27 |
|
|
|
28 |
root |
1.1 |
no warnings; |
29 |
root |
1.4 |
use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype |
30 |
root |
1.16 |
inplace io pipe unpack glob digit printf |
31 |
root |
1.2 |
layer reserved taint closure semicolon); |
32 |
root |
1.1 |
no warnings qw(exec newline unopened); |
33 |
|
|
|
34 |
|
|
BEGIN { |
35 |
root |
1.13 |
$H = $^H; |
36 |
|
|
$WARN = ${^WARNING_BITS}; |
37 |
root |
1.10 |
%H = %^H; |
38 |
root |
1.1 |
} |
39 |
|
|
|
40 |
|
|
while (<DATA>) { |
41 |
|
|
if (/^IMPORT/) { |
42 |
|
|
print " # use warnings\n"; |
43 |
|
|
printf " \${^WARNING_BITS} ^= \${^WARNING_BITS} ^ \"%s\";\n", |
44 |
|
|
join "", map "\\x$_", unpack "(H2)*", $WARN; |
45 |
root |
1.10 |
print " # use strict, use utf8; use feature;\n"; |
46 |
root |
1.1 |
printf " \$^H |= 0x%x;\n", $H; |
47 |
root |
1.10 |
|
48 |
root |
1.18 |
if (my @features = grep /^feature_/, sort keys %H) { |
49 |
root |
1.10 |
print " \@^H{qw(@features)} = (1) x ", (scalar @features), ";\n"; |
50 |
|
|
} |
51 |
root |
1.14 |
} elsif (/^VERSION/) { |
52 |
|
|
print "our \$VERSION = $VERSION;\n"; |
53 |
root |
1.1 |
} else { |
54 |
|
|
print; |
55 |
|
|
} |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
close STDOUT; |
59 |
|
|
rename "$ARGV[0]~", $ARGV[0]; |
60 |
|
|
|
61 |
|
|
__DATA__ |
62 |
|
|
package common::sense; |
63 |
|
|
|
64 |
root |
1.14 |
VERSION |
65 |
root |
1.1 |
|
66 |
|
|
# overload should be included |
67 |
|
|
|
68 |
|
|
sub import { |
69 |
root |
1.10 |
local $^W; # work around perl 5.16 spewing out warnings for next statement |
70 |
root |
1.1 |
IMPORT |
71 |
|
|
} |
72 |
|
|
|
73 |
root |
1.13 |
1 |