The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
## name basic failures
## failures 12
## cut

open $fh, ">$output";
open($fh, ">$output");
open($fh, ">$output") or die;

open my $fh, ">$output";
open(my $fh, ">$output");
open(my $fh, ">$output") or die;

open FH, ">$output";
open(FH, ">$output");
open(FH, ">$output") or die;

#This are tricky because the Critic can't
#tell where the expression really ends
open FH, ">$output" or die;
open $fh, ">$output" or die;
open my $fh, ">$output" or die;

#-----------------------------------------------------------------------------

## name basic passes
## failures 0
## cut

open $fh, '>', $output;
open($fh, '>', $output);
open($fh, '>', $output) or die;

open my $fh, '>', $output;
open(my $fh, '>', $output);
open(my $fh, '>', $output) or die;

open FH, '>', $output;
open(FH, '>', $output);
open(FH, '>', $output) or die;

#This are tricky because the Critic can't
#tell where the expression really ends
open $fh, '>', $output or die;
open my $fh, '>', $output or die;
open FH, '>', $output or die;

$foo{open}; # not a function call

#-----------------------------------------------------------------------------

## name no three-arg equivalent passes
## failures 0
## cut

open( STDOUT, '>&STDOUT' );
open( STDIN, '>&STDIN' );
open( STDERR, '>&STDERR' );

open( \*STDOUT, '>&STDERR' );
open( *STDOUT, '>&STDERR' );
open( STDOUT, '>&STDERR' );

# These are actually forks
open FH, '-|';
open FH, '|-';

open FH, q{-|};
open FH, qq{-|};
open FH, "-|";

# Other file modes.
open( \*STDOUT, '>>&STDERR' );
open( \*STDOUT, '<&STDERR' );
open( \*STDOUT, '+>&STDERR' );
open( \*STDOUT, '+>>&STDERR' );
open( \*STDOUT, '+<&STDERR' );

#-----------------------------------------------------------------------------

## name pass with "use 5.005"
## failures 0
## cut

open $fh, ">$output";
use 5.005;

#-----------------------------------------------------------------------------

## name fail with "use 5.006"
## failures 1
## cut

open $fh, ">$output";
use 5.006;

#-----------------------------------------------------------------------------

## name rt44554 two arg open should fail
## failures 1
## cut

open my $a, 'testing' or die 'error: ', $!;

#-----------------------------------------------------------------------------

##############################################################################
#      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic/t/InputOutput/ProhibitTwoArgOpen.run $
#     $Date: 2009-08-08 16:35:01 -0700 (Sat, 08 Aug 2009) $
#   $Author: clonezone $
# $Revision: 3504 $
##############################################################################

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :