Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / lib / Perl / Critic / Policy / InputOutput / ProhibitInteractiveTest.pm
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) $
4 #   $Author: clonezone $
5 # $Revision: 2489 $
6 ##############################################################################
7
8 package Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest;
9
10 use 5.006001;
11 use strict;
12 use warnings;
13 use Readonly;
14
15 use Perl::Critic::Utils qw{ :severities };
16 use base 'Perl::Critic::Policy';
17
18 our $VERSION = '1.088';
19
20 #-----------------------------------------------------------------------------
21
22 Readonly::Scalar my $DESC => q{Use IO::Interactive::is_interactive() instead of -t};
23 Readonly::Scalar my $EXPL => [ 218 ];
24
25 #-----------------------------------------------------------------------------
26
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' }
31
32 #-----------------------------------------------------------------------------
33
34 sub violates {
35     my ($self, $elem, $doc) = @_;
36     return if $elem ne '-t';
37     return $self->violation( $DESC, $EXPL, $elem );
38 }
39
40 1;
41
42 #-----------------------------------------------------------------------------
43
44 __END__
45
46 =pod
47
48 =head1 NAME
49
50 Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest - Use prompt() instead of -t.
51
52 =head1 AFFILIATION
53
54 This Policy is part of the core L<Perl::Critic> distribution.
55
56
57 =head1 DESCRIPTION
58
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>.
62
63
64 =head1 CONFIGURATION
65
66 This Policy is not configurable except for the standard options.
67
68
69 =head1 AUTHOR
70
71 Chris Dolan <cdolan@cpan.org>
72
73 =head1 COPYRIGHT
74
75 Copyright (C) 2006 Chris Dolan.  All rights reserved.
76
77 This program is free software; you can redistribute it and/or modify
78 it under the same terms as Perl itself.
79
80 =cut
81
82 # Local Variables:
83 #   mode: cperl
84 #   cperl-indent-level: 4
85 #   fill-column: 78
86 #   indent-tabs-mode: nil
87 #   c-indentation-style: bsd
88 # End:
89 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :