perl

 view release on metacpan or  search on metacpan

t/lib/warnings/doio  view on Meta::CPAN

OPTION regex
Statement unlikely to be reached at - line .+
	\(Maybe you meant system\(\) when you said exec\(\)\?\)
Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
########
# doio.c [win32_execvp]
use warnings 'exec' ;
exec $^X, "-e0" ;
EXPECT
########
# doio.c [Perl_nextargv]
$^W = 0 ;
# These happen to warn at different points within doio.c
# This will open read only, and then be caught by an explicit check:
my $filename = "./temp.dir" ;
# Whereas these two will fail to open:
my $dir0 = "./zero.dir" ;
# but files and directories have a different error message if they don't open:
my $file3 = "date|" ;
mkdir $filename, 0777 
  or die "Cannot create directory $filename: $!\n" ;
mkdir $dir0, 0
  or die "Cannot create directory dir0: $!\n" ;
{
    local (@ARGV) = ($filename, $dir0, $file3) ;
    local ($^I) = "" ;
    my $x = <> ;
}
{
    no warnings 'inplace' ;
    local (@ARGV) = ($filename, $dir0, $file3) ;
    local ($^I) = "" ;
    my $x = <> ;
}
{
    use warnings 'inplace' ;
    local (@ARGV) = ($filename, $dir0, $file3) ;
    local ($^I) = "" ;
    my $x = <> ;
}
rmdir $filename ;
chmod 0777, $dir0 ;
rmdir $dir0 ;
EXPECT
OPTION regex
Can't do inplace edit: \./temp\.dir is not a regular file at - line 17\.
Can't do inplace edit: \./zero\.dir is not a regular file at - line 17\.
Can't open date\|: .*? at - line 17\.
Can't do inplace edit: \./temp\.dir is not a regular file at - line 29\.
Can't do inplace edit: \./zero\.dir is not a regular file at - line 29\.
Can't open date\|: .*? at - line 29\.
########
# doio.c [Perl_do_eof]
use warnings 'io' ;
my $a = eof STDOUT ;
no warnings 'io' ;
$a = eof STDOUT ;
EXPECT
Filehandle STDOUT opened only for output at - line 3.
########
# doio.c [Perl_do_openn]
use Config;
BEGIN {
    if ($Config{useperlio}) {
	print <<EOM;
SKIPPED
# warns only without perlio
EOM
	exit;
    }
}
use warnings 'io';
my $x = "foo";
open FOO, '>', \$x;
open BAR, '>&', \*STDOUT; # should not warn
no warnings 'io';
open FOO, '>', \$x;
EXPECT
Can't open a reference at - line 14.
########
# doio.c [Perl_do_openn]
use Config;
BEGIN {
    if (!$Config{useperlio}) {
	print <<EOM;
SKIPPED
# warns only with perlio
EOM
	exit;
    }
}
use warnings 'io' ;
close STDOUT;
open FH1, "../harness"; close FH1;
no warnings 'io' ;
open FH2, "../harness"; close FH2;
EXPECT
Filehandle STDOUT reopened as FH1 only for input at - line 14.
########
# doio.c [Perl_do_openn]
use Config;
use utf8;
use open qw( :utf8 :std );
BEGIN {
    if (!$Config{useperlio}) {
	print <<EOM;
SKIPPED
# warns only with perlio
EOM
	exit;
    }
}
use warnings 'io' ;
close STDOUT;
open ᶠᚻ1, "../harness"; close ᶠᚻ1;
no warnings 'io' ;
open ᶠᚻ2, "../harness"; close ᶠᚻ2;
EXPECT
Filehandle STDOUT reopened as ᶠᚻ1 only for input at - line 16.
########
# doio.c [Perl_do_openn]
use Config;
BEGIN {
    if (!$Config{useperlio}) {
	print <<EOM;
SKIPPED
# warns only with perlio
EOM
	exit;
    }
}
use warnings 'io' ;
close STDIN;
open my $fh1, ">doiowarn.tmp"; close $fh1;
no warnings 'io' ;
open my $fh2, ">doiowarn.tmp"; close $fh2;
unlink "doiowarn.tmp";
EXPECT
Filehandle STDIN reopened as $fh1 only for output at - line 14.
########
# doio.c [Perl_do_openn]
use Config;
use utf8;
use open qw( :utf8 :std );
BEGIN {
    if (!$Config{useperlio}) {
	print <<EOM;
SKIPPED
# warns only with perlio
EOM
	exit;
    }
}
use warnings 'io' ;
close STDIN;
open my $ᶠᚻ1, ">doiowarn.tmp"; close $ᶠᚻ1;
no warnings 'io' ;
open my $ᶠᚻ2, ">doiowarn.tmp"; close $ᶠᚻ2;
unlink "doiowarn.tmp";
EXPECT
Filehandle STDIN reopened as $ᶠᚻ1 only for output at - line 16.
########
# doio.c [Perl_do_openn]
use Config;
use utf8;
use open qw( :utf8 :std );
BEGIN {
    if (!$Config{useperlio}) {
	print <<EOM;
SKIPPED
# warns only with perlio
EOM
	exit;
    }
}
use warnings 'io' ;
close STDIN;
open ᶠᚻ1, ">doiowarn.tmp"; close ᶠᚻ1;
no warnings 'io' ;
open ᶠᚻ2, ">doiowarn.tmp"; close ᶠᚻ2;
unlink "doiowarn.tmp";
EXPECT
Filehandle STDIN reopened as ᶠᚻ1 only for output at - line 16.
########
open(my $i, "foo\0bar");
use warnings 'io';
open(my $i, "foo\0bar");
EXPECT
Invalid \0 character in pathname for open: foo\0bar at - line 3.
########
chmod(0, "foo\0bar");
use warnings 'io';
chmod(0, "foo\0bar");
EXPECT
Invalid \0 character in pathname for chmod: foo\0bar at - line 3.
########
unlink("foo\0bar", "foo\0bar2");
use warnings 'io';
unlink("foo\0bar", "foo\0bar2");
EXPECT
Invalid \0 character in pathname for unlink: foo\0bar at - line 3.
Invalid \0 character in pathname for unlink: foo\0bar2 at - line 3.
########
utime(-1, -1, "foo\0bar", "foo\0bar2");
use warnings 'io';
utime(-1, -1, "foo\0bar", "foo\0bar2");
EXPECT
Invalid \0 character in pathname for utime: foo\0bar at - line 3.
Invalid \0 character in pathname for utime: foo\0bar2 at - line 3.
########
my @foo = glob "foo\0bar";
use warnings 'io';
my @bar = glob "foo\0bar";
EXPECT
Invalid \0 character in pattern for glob: foo\0bar at - line 3.



( run in 1.409 second using v1.01-cache-2.11-cpan-98e64b0badf )