line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Role::Declare::Should; |
2
|
2
|
|
|
2
|
|
261382
|
use strict; |
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
63
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
10
|
use Devel::StrictMode; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
5
|
2
|
|
|
2
|
|
1039
|
use Import::Into; |
|
2
|
|
|
|
|
5799
|
|
|
2
|
|
|
|
|
213
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
2
|
|
|
2
|
|
23
|
shift; # remove self |
9
|
2
|
|
|
|
|
9
|
my $pkg = caller; |
10
|
2
|
|
|
|
|
44
|
unless (STRICT) { |
11
|
2
|
|
|
|
|
10
|
push @_, -lax, -no_type_check; |
12
|
|
|
|
|
|
|
} |
13
|
2
|
|
|
|
|
49
|
Role::Declare->import::into($pkg, @_); |
14
|
1
|
|
|
|
|
46
|
return; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
18
|
|
|
|
|
|
|
=pod |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=encoding utf8 |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Role::Declare::Should - skip some checks when not testing |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
package My::New::Role; |
29
|
|
|
|
|
|
|
use Role::Declare::Should; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This module is a drop-in replacement for L<Role::Declare> which will |
34
|
|
|
|
|
|
|
additionally disable argument count and type checks when not running |
35
|
|
|
|
|
|
|
in a test environment, as determined by L<Devel::StrictMode>. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
If B<STRICT> is enabled, using L<Role::Declare::Should> is functionally |
38
|
|
|
|
|
|
|
identical to L<Role::Declare> (any import arguments are passed on). |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
If B<STRICT> is not enabled, it's equivalent to: |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use Role::Declare -lax, -no_type_check; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Szymon Nieznański <snieznanski@perceptyx.com> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 LICENSE |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
'Role::Declare' is Copyright (C) 2020, Perceptyx Inc |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
53
|
|
|
|
|
|
|
the terms of the Artistic License 2.0. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This package is distributed in the hope that it will be useful, but it is |
56
|
|
|
|
|
|
|
provided "as is" and without any express or implied warranties. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
For details, see the full text of the license in the file LICENSE. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |