ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/common-sense/sense.pm.PL
Revision: 1.13
Committed: Tue Jul 30 23:27:09 2013 UTC (10 years, 9 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-3_7
Changes since 1.12: +5 -461 lines
Log Message:
3.7

File Contents

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