1 ##############################################################################
2 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/ProhibitInteractiveTest.pm $
3 # $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
6 ##############################################################################
8 package Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest;
15 use Perl::Critic::Utils qw{ :severities };
16 use base 'Perl::Critic::Policy';
18 our $VERSION = '1.088';
20 #-----------------------------------------------------------------------------
22 Readonly::Scalar my $DESC => q{Use IO::Interactive::is_interactive() instead of -t};
23 Readonly::Scalar my $EXPL => [ 218 ];
25 #-----------------------------------------------------------------------------
27 sub supported_parameters { return () }
28 sub default_severity { return $SEVERITY_HIGHEST }
29 sub default_themes { return qw( core pbp bugs ) }
30 sub applies_to { return 'PPI::Token::Operator' }
32 #-----------------------------------------------------------------------------
35 my ($self, $elem, $doc) = @_;
36 return if $elem ne '-t';
37 return $self->violation( $DESC, $EXPL, $elem );
42 #-----------------------------------------------------------------------------
50 Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest - Use prompt() instead of -t.
54 This Policy is part of the core L<Perl::Critic> distribution.
59 The C<-t> operator is fragile and complicated. When you are testing
60 whether C<STDIN> is interactive, It's much more robust to use
61 well-tested CPAN modules like L<IO::Interactive>.
66 This Policy is not configurable except for the standard options.
71 Chris Dolan <cdolan@cpan.org>
75 Copyright (C) 2006 Chris Dolan. All rights reserved.
77 This program is free software; you can redistribute it and/or modify
78 it under the same terms as Perl itself.
84 # cperl-indent-level: 4
86 # indent-tabs-mode: nil
87 # c-indentation-style: bsd
89 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :