« blib/lib/Perl/Critic/PolicyListing.pm
↑ Summary
blib/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitImplicitNewlines.pm »
| 1 | package Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest; | ||||||||||
| 2 | |||||||||||
| 3 | 40 | ▶ | use 5.010001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 40 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 40 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 40 | ▶ | use Readonly; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 40 | ▶ | use Perl::Critic::Utils qw{ :severities }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 40 | ▶ | use parent 'Perl::Critic::Policy'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 40 | our $VERSION = '1.150'; | |||||||||
| 12 | |||||||||||
| 13 | #----------------------------------------------------------------------------- | ||||||||||
| 14 | |||||||||||
| 15 | 40 | Readonly::Scalar my $DESC => q{Use IO::Interactive::is_interactive() instead of -t}; | |||||||||
| 16 | 40 | Readonly::Scalar my $EXPL => [ 218 ]; | |||||||||
| 17 | |||||||||||
| 18 | #----------------------------------------------------------------------------- | ||||||||||
| 19 | |||||||||||
| 20 | 90 | ▶ | sub supported_parameters { return () } | ||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | 75 | ▶ | sub default_severity { return $SEVERITY_HIGHEST } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | 92 | ▶ | sub default_themes { return qw( core pbp bugs certrule ) } | ||||||||
|
Subroutine
default_themes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 23 | 37 | ▶ | sub applies_to { return 'PPI::Token::Operator' } | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 24 | |||||||||||
| 25 | #----------------------------------------------------------------------------- | ||||||||||
| 26 | |||||||||||
| 27 | sub violates { | ||||||||||
| 28 | 143 | ▶ | my ($self, $elem, $doc) = @_; | ||||||||
|
Subroutine
violates: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||
| 29 | 143 | ▶ | return if $elem->content() ne '-t'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | return $self->violation( $DESC, $EXPL, $elem ); | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 40 | 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 : | ||||||||||