line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest; |
2
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
26608
|
use 5.010001; |
|
40
|
|
|
|
|
170
|
|
4
|
40
|
|
|
40
|
|
241
|
use strict; |
|
40
|
|
|
|
|
108
|
|
|
40
|
|
|
|
|
871
|
|
5
|
40
|
|
|
40
|
|
232
|
use warnings; |
|
40
|
|
|
|
|
110
|
|
|
40
|
|
|
|
|
1040
|
|
6
|
40
|
|
|
40
|
|
224
|
use Readonly; |
|
40
|
|
|
|
|
134
|
|
|
40
|
|
|
|
|
2051
|
|
7
|
|
|
|
|
|
|
|
8
|
40
|
|
|
40
|
|
320
|
use Perl::Critic::Utils qw{ :severities }; |
|
40
|
|
|
|
|
144
|
|
|
40
|
|
|
|
|
2200
|
|
9
|
40
|
|
|
40
|
|
5201
|
use parent 'Perl::Critic::Policy'; |
|
40
|
|
|
|
|
101
|
|
|
40
|
|
|
|
|
270
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.146'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Use IO::Interactive::is_interactive() instead of -t}; |
16
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => [ 218 ]; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
91
|
|
|
91
|
0
|
1648
|
sub supported_parameters { return () } |
21
|
76
|
|
|
76
|
1
|
395
|
sub default_severity { return $SEVERITY_HIGHEST } |
22
|
92
|
|
|
92
|
1
|
423
|
sub default_themes { return qw( core pbp bugs certrule ) } |
23
|
38
|
|
|
38
|
1
|
115
|
sub applies_to { return 'PPI::Token::Operator' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub violates { |
28
|
145
|
|
|
145
|
1
|
317
|
my ($self, $elem, $doc) = @_; |
29
|
145
|
100
|
|
|
|
303
|
return if $elem->content() ne '-t'; |
30
|
2
|
|
|
|
|
17
|
return $self->violation( $DESC, $EXPL, $elem ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest - Use prompt() instead of -t. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AFFILIATION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This Policy is part of the core L<Perl::Critic|Perl::Critic> |
48
|
|
|
|
|
|
|
distribution. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The C<-t> operator is fragile and complicated. When you are testing |
54
|
|
|
|
|
|
|
whether C<STDIN> is interactive, It's much more robust to use |
55
|
|
|
|
|
|
|
well-tested CPAN modules like L<IO::Interactive|IO::Interactive>. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 CONFIGURATION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Chris Dolan <cdolan@cpan.org> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 COPYRIGHT |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Copyright (c) 2006-2011 Chris Dolan. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
72
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Local Variables: |
77
|
|
|
|
|
|
|
# mode: cperl |
78
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
79
|
|
|
|
|
|
|
# fill-column: 78 |
80
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
81
|
|
|
|
|
|
|
# c-indentation-style: bsd |
82
|
|
|
|
|
|
|
# End: |
83
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |