File Coverage

blib/lib/uni/perl.pm
Criterion Covered Total %
statement 67 67 100.0
branch 5 8 62.5
condition n/a
subroutine 8 8 100.0
pod n/a
total 80 83 96.3


line stmt bran cond sub pod time code
1             package uni::perl;
2              
3             our $VERSION = '0.92';
4              
5             BEGIN {
6 7 50   7   169769 defined ${^WARNING_BITS}
7             ? ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03\x3f\x00\xc0"
8             : ${^WARNING_BITS} = "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03\x3f\x00\xc0";
9 7         381 $^H |= 0x1c8e0ee2;
10              
11             }
12             m{
13             use strict;
14             use warnings;
15             }x;
16 7     7   14110 use mro ();
  7         5900  
  7         369  
17              
18             # paste this into perl to find bitmask
19              
20             # no warnings;
21             # use warnings qw(FATAL closed threads internal debugging pack substr malloc unopened portable prototype
22             # inplace io pipe unpack regexp deprecated exiting glob digit printf
23             # utf8 layer reserved parenthesis taint closure semicolon);
24             # no warnings qw(exec newline);
25             # BEGIN { warn join "", map "\\x$_", unpack "(H2)*", ${^WARNING_BITS}; exit 0 };
26              
27             BEGIN {
28 7     7   17 for my $sub (qw(carp croak confess)) {
29 7     7   48 no strict 'refs';
  7         15  
  7         943  
30             *$sub = sub {
31 3     3   3365 my $caller = caller;
32 3         12 local *__ANON__ = $caller .'::'. $sub;
33 3         21 require Carp;
34 3         5 *{ $caller.'::'.$sub } = \&{ 'Carp::'.$sub };
  3         11  
  3         12  
35 3         5 goto &{ 'Carp::'.$sub };
  3         644  
36 21         1618 };
37             }
38             }
39              
40             sub import {
41 18     18   3733 my $me = shift;
42 18         41 my $caller = caller;
43 18         70 local $^W;
44             # use warnings
45 18         87 ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03\x3f\x00\xc0";
46              
47             # use strict, utf8, open, 5.010, ...
48 18         34 $^H |= 0x1c8e0ee2;
49              
50             # use feature qw(feature_switch feature_unicode open> feature_state feature_arybase feature_say open<)
51 18         83 $^H{'feature_switch'} = 1;
52 18         54 $^H{'feature_unicode'} = 1;
53 18         56 $^H{'open>'} = ":utf8";
54 18         50 $^H{'feature_state'} = 1;
55 18         56 $^H{'feature_arybase'} = 1;
56 18         53 $^H{'feature_say'} = 1;
57 18         116 $^H{'open<'} = ":utf8";
58              
59             # use mro 'c3';
60 18         133 mro::set_mro($caller, 'c3');
61            
62             #use open (:utf8 :std);
63 18         101 ${^OPEN} = ":utf8\0:utf8";
64 18         87 binmode(STDIN, ":utf8");
65 18         47 binmode(STDOUT, ":utf8");
66 18         45 binmode(STDERR, ":utf8");
67            
68 18         42 for my $sub (qw(carp croak confess)) {
69 7     7   36 no strict 'refs';
  7         13  
  7         2993  
70 54         95 *{ $caller .'::'. $sub } = \&$sub;
  54         273  
71             }
72 18 100       760 return if $caller =~ /^$me/;
73 8         33 while (@_) {
74 3         5 my $feature = shift;
75 3 50       26 if ($feature =~ s/^://) {
76 3         9 my $package = $me. '::'. $feature;
77 3 50       274 eval "require $package; 1" or croak( "$@" );
78 3         33 $package->load( $caller );
79             }
80             }
81 8         4169 require uni::perl::utf;
82 8         68 uni::perl::utf->load($caller);
83 8         10334 return;
84             }
85              
86             sub unimport {
87 1     1   9 my $me = shift;
88 1         2 my $caller = caller;
89             # no warnings
90 1         3 ${^WARNING_BITS} = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
91              
92             # no strict, utf8, open, 5.010, ...
93 1         3 $^H &= ~0x1c8e0ee2;
94              
95             # no feature qw(feature_switch feature_unicode open> feature_state feature_arybase feature_say open<)
96 1         5 delete $^H{'feature_switch'};
97 1         3 delete $^H{'feature_unicode'};
98 1         3 delete $^H{'open>'};
99 1         4 delete $^H{'feature_state'};
100 1         4 delete $^H{'feature_arybase'};
101 1         5 delete $^H{'feature_say'};
102 1         3 delete $^H{'open<'};
103              
104 1         24 ${^OPEN} = ":raw\0:raw";
105 1         6 binmode(STDIN, ":raw");
106 1         3 binmode(STDOUT, ":raw");
107 1         3 binmode(STDERR, ":raw");
108 1         1866 return;
109             }
110              
111             1;
112              
113             __END__