[system] / trunk / pg / lib / ww_strict.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/ww_strict.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2157 Revision 2163
87my %bitmask = ( 87my %bitmask = (
88refs => 0x00000002, 88refs => 0x00000002,
89subs => 0x00000200, 89subs => 0x00000200,
90vars => 0x00000400 90vars => 0x00000400
91); 91);
92#require Carp; 92
93# sub bits {
94# my $bits = 0;
95# foreach my $s (@_){ $bits |= $bitmask{$s} || 0; };
96# $bits;
97# }
98sub bits { 93sub bits {
99 my $bits = 0; 94 my $bits = 0;
100 my @wrong; 95 foreach my $s (@_){ $bits |= $bitmask{$s} || 0; };
101 foreach my $s (@_) {
102 push @wrong, $s unless exists $bitmask{$s};
103 $bits |= $bitmask{$s} || 0;
104 }
105 if (@wrong) {
106# require Carp;
107
108 Carp::croak("Unknown 'strict' tag(s) '@wrong'");
109 }
110 $bits; 96 $bits;
111} 97}
112my $default_bits = bits(qw(refs subs vars));
113 98
114sub import { 99sub import {
115 shift; 100 shift;
116 $^H |= @_ ? bits(@_) : $default_bits; 101 $^H |= bits(@_ ? @_ : qw(refs subs vars));
117} 102}
118 103
119sub unimport { 104sub unimport {
120 shift; 105 shift;
121 $^H &= ~ (@_ ? bits(@_) : $default_bits); 106 $^H &= ~ bits(@_ ? @_ : qw(refs subs vars));
122} 107}
123 108
1241; 1091;

Legend:
Removed from v.2157  
changed lines
  Added in v.2163

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9