ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/common-sense/sense.pm.PL
Revision: 1.19
Committed: Thu Apr 2 07:53:41 2020 UTC (4 years, 1 month ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-3_75, HEAD
Changes since 1.18: +2 -2 lines
Log Message:
3.75

File Contents

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