diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2011-02-17 17:57:31 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2011-02-17 17:57:31 +0000 |
commit | 320d8694fec25ed148613684543b5a0504a046ae (patch) | |
tree | 0ddcf933d3acd3c98a387fa2bf73d0554ca6e50d /Master/tlpkg/tlperl/lib/warnings | |
parent | 779e71f16ca01a6244b632b95bdb461fec163b34 (diff) |
New tlperl part XIV
git-svn-id: svn://tug.org/texlive/trunk@21436 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/warnings')
-rw-r--r-- | Master/tlpkg/tlperl/lib/warnings/register.pm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/warnings/register.pm b/Master/tlpkg/tlperl/lib/warnings/register.pm new file mode 100644 index 00000000000..57c865df522 --- /dev/null +++ b/Master/tlpkg/tlperl/lib/warnings/register.pm @@ -0,0 +1,51 @@ +package warnings::register; + +our $VERSION = '1.01'; + +=pod + +=head1 NAME + +warnings::register - warnings import function + +=head1 SYNOPSIS + + use warnings::register; + +=head1 DESCRIPTION + +Creates a warnings category with the same name as the current package. + +See L<warnings> and L<perllexwarn> for more information on this module's +usage. + +=cut + +require warnings; + +sub mkMask +{ + my ($bit) = @_; + my $mask = ""; + + vec($mask, $bit, 1) = 1; + return $mask; +} + +sub import +{ + shift; + my $package = (caller(0))[0]; + if (! defined $warnings::Bits{$package}) { + $warnings::Bits{$package} = mkMask($warnings::LAST_BIT); + vec($warnings::Bits{'all'}, $warnings::LAST_BIT, 1) = 1; + $warnings::Offsets{$package} = $warnings::LAST_BIT ++; + foreach my $k (keys %warnings::Bits) { + vec($warnings::Bits{$k}, $warnings::LAST_BIT, 1) = 0; + } + $warnings::DeadBits{$package} = mkMask($warnings::LAST_BIT); + vec($warnings::DeadBits{'all'}, $warnings::LAST_BIT++, 1) = 1; + } +} + +1; |