xref: /openbsd-src/gnu/usr.bin/perl/lib/warnings/register.pm (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1package warnings::register;
2
3our $VERSION = '1.02';
4
5=pod
6
7=head1 NAME
8
9warnings::register - warnings import function
10
11=head1 SYNOPSIS
12
13    use warnings::register;
14
15=head1 DESCRIPTION
16
17Creates a warnings category with the same name as the current package.
18
19See L<warnings> and L<perllexwarn> for more information on this module's
20usage.
21
22=cut
23
24require warnings;
25
26# left here as cruft in case other users were using this undocumented routine
27# -- rjbs, 2010-09-08
28sub mkMask
29{
30    my ($bit) = @_;
31    my $mask = "";
32
33    vec($mask, $bit, 1) = 1;
34    return $mask;
35}
36
37sub import
38{
39    shift;
40    my @categories = @_;
41
42    my $package = (caller(0))[0];
43    warnings::register_categories($package);
44
45    warnings::register_categories($package . "::$_") for @categories;
46}
47
481;
49