develooper Front page | perl.perl5.porters | Postings from April 2003

Minor change to strict.pm. Who? How?

Thread Next
From:
Adam Kennedy
Date:
April 29, 2003 06:40
Subject:
Minor change to strict.pm. Who? How?
Message ID:
3EAE7064.8010703@ali.as
I have a minor change to make to strict.pm, but not sure who the 
pumpking is for it. Since strict.pm is fairly trivial, I'll include it 
here for the interested.

package strict;

### POD snipped

$strict::VERSION = "1.03";

my %bitmask = (
refs => 0x00000002,
subs => 0x00000200,
vars => 0x00000400
);

# refs & subs & vars
my $default = 0x00000602;

sub bits {
     my $bits = 0;
     foreach my $s (@_){ $bits |= $bitmask{$s} || 0; };
     $bits;
}

sub import {
     shift;
     $^H |= @_ ? bits @_ : $default;
}

sub unimport {
     shift;
     $^H &= ~ (@_ ? bits @_ : $default);
}



The change just predefines the value of bits( qw{refs subs vars} ). It 
should make a both trivial and negligable improvement in startup times. 
More importantly ( at least for me ) it reduces the entries due to C<use 
strict;> in dprofpp -t, and makes it a little easier when debugging 
startup stuff with an early BEGIN { $DB::Single = 1 }

Anyways, where to from here?

Adam K


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About