This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to assertions-0.03
[perl5.git] / lib / assertions / activate.pm
1 package assertions::activate;
2
3 our $VERSION = '0.02';
4
5 sub import {
6     shift;
7     @_ = '.*' unless @_;
8     push @{^ASSERTING}, map { ref $_ eq 'Regexp' ? $_ : qr/^(?:$_)\z/ } @_;
9 }
10
11 1;
12 __END__
13
14 =head1 NAME
15
16 assertions::activate - activate assertions
17
18 =head1 SYNOPSIS
19
20   use assertions::activate 'Foo', 'bar', 'Foo::boz::.*';
21
22   # activate all assertions
23   use assertions::activate;
24
25 =head1 DESCRIPTION
26
27 This module is used internally by perl (and its C<-A> command-line switch) to
28 enable and disable assertions.
29
30 Though it can also be explicetly used:
31
32   use assertions::activate qw(foo bar);
33
34 The import parameters are a list of strings or of regular expressions. The
35 assertion tags that match those regexps are enabled. If no parameter is
36 given, all assertions are activated.
37
38 =head1 SEE ALSO
39
40 L<assertions>, L<perlrun>.
41
42 =head1 AUTHOR
43
44 Salvador FandiE<ntilde>o, E<lt>sfandino@yahoo.comE<gt>
45
46 =head1 COPYRIGHT AND LICENSE
47
48 Copyright 2002, 2005 by Salvador FandiE<ntilde>o
49
50 This library is free software; you can redistribute it and/or modify
51 it under the same terms as Perl itself.
52
53 =cut