line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
403
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
use Perl::Critic::Utils qw(:severities :classification :ppi); |
6
|
1
|
|
|
1
|
|
5
|
use parent 'Perl::Critic::Policy'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
7
|
1
|
|
|
1
|
|
305
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
our $VERSION = 'v1.0.3'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use constant DESC => 'Using POSIX.pm without an explicit import list'; |
11
|
1
|
|
|
1
|
|
71
|
use constant EXPL => 'Using the POSIX module without specifying an import list results in importing hundreds of symbols. Import the functions or constants you want explicitly, or prevent the import with ().'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
12
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
167
|
|
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
0
|
11624
|
my ($self, $elem) = @_; |
15
|
2
|
|
|
2
|
1
|
165
|
return $self->violation(DESC, EXPL, $elem) if ($elem->type // '') eq 'use' |
16
|
0
|
|
|
0
|
1
|
0
|
and ($elem->module // '') eq 'POSIX' and !$elem->arguments; |
17
|
4
|
|
|
4
|
1
|
19014
|
return (); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
5
|
1
|
76
|
1; |
21
|
5
|
100
|
50
|
|
|
14
|
|
|
|
|
50
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
3
|
|
|
|
|
200
|
|
24
|
|
|
|
|
|
|
Perl::Critic::Policy::Community::POSIXImports - Don't use POSIX without |
25
|
|
|
|
|
|
|
specifying an import list |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The L<POSIX> module imports hundreds of symbols (functions and constants) by |
30
|
|
|
|
|
|
|
default for backwards compatibility reasons. To avoid this, and to assist in |
31
|
|
|
|
|
|
|
finding where functions have been imported from, specify the symbols you want |
32
|
|
|
|
|
|
|
to import explicitly in the C<use> statement. Alternatively, specify an empty |
33
|
|
|
|
|
|
|
import list with C<use POSIX ()> to avoid importing any symbols, and fully |
34
|
|
|
|
|
|
|
qualify the functions or constants, such as C<POSIX::strftime>. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use POSIX; # not ok |
37
|
|
|
|
|
|
|
use POSIX (); # ok |
38
|
|
|
|
|
|
|
use POSIX 'fcntl'; # ok |
39
|
|
|
|
|
|
|
use POSIX qw(O_APPEND O_CREAT O_EXCL O_RDONLY O_RDWR O_WRONLY); # ok |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 AFFILIATION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This policy is part of L<Perl::Critic::Community>. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 CONFIGURATION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This policy is not configurable except for the standard options. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 AUTHOR |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Dan Book, C<dbook@cpan.org> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Copyright 2015, Dan Book. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This library is free software; you may redistribute it and/or modify it under |
58
|
|
|
|
|
|
|
the terms of the Artistic License version 2.0. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L<Perl::Critic> |