This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use a switch in pp_prototype for compactness
[perl5.git] / lib / warnings / register.pm
CommitLineData
5ca7f68d 1package warnings::register;
d3a7d8c7 2
26e1fc47 3our $VERSION = '1.02';
b75c8c73 4
4755096e
GS
5=pod
6
7=head1 NAME
8
9warnings::register - warnings import function
10
c5035329
PM
11=head1 SYNOPSIS
12
5ca7f68d 13 use warnings::register;
c5035329
PM
14
15=head1 DESCRIPTION
16
5ca7f68d 17Creates a warnings category with the same name as the current package.
c5035329 18
5ca7f68d
RGS
19See L<warnings> and L<perllexwarn> for more information on this module's
20usage.
c5035329 21
4755096e
GS
22=cut
23
5ca7f68d 24require warnings;
d3a7d8c7 25
572bfd36
RS
26# left here as cruft in case other users were using this undocumented routine
27# -- rjbs, 2010-09-08
d3a7d8c7
GS
28sub mkMask
29{
5ca7f68d
RGS
30 my ($bit) = @_;
31 my $mask = "";
d3a7d8c7 32
5ca7f68d
RGS
33 vec($mask, $bit, 1) = 1;
34 return $mask;
d3a7d8c7
GS
35}
36
37sub import
38{
5ca7f68d 39 shift;
572bfd36
RS
40 my @categories = @_;
41
5ca7f68d 42 my $package = (caller(0))[0];
5e7ad92a 43 warnings::register_categories($package);
572bfd36 44
5e7ad92a 45 warnings::register_categories($package . "::$_") for @categories;
d3a7d8c7
GS
46}
47
5ca7f68d 481;