sub _has_flags { my $check_flag = _names_to_flags(@_); return sub { my ($fh, $layer) = @_; my $iterator = natatime(3, PerlIO::get_layers($fh, details => 1)); while (my ($name, $arguments, $flags) = $iterator->()) { next if defined $layer and $name ne $layer; print('FL='.unpack('H8',pack('N',$flags)).','.unpack('B32',pack('N',$flags))."\n"); print('CK='.unpack('H8',pack('N',$check_flag)).','.unpack('B32',pack('N',$check_flag))."\n"); my $entry = $flags & $check_flag; return 1 if $entry; } return 0; } } #### $VAR1 = { "\$mode" => "<:encoding(utf8)", "\$fh" => \*{"main::\$fh"}, "\$test_type" => "crlf", "\$result_for{\$test_type}" => 1 }; FL=00408400,00000000010000001000010000000000 CK=00004000,00000000000000000100000000000000 FL=00408400,00000000010000001000010000000000 CK=00004000,00000000000000000100000000000000 FL=00408400,00000000010000001000010000000000 CK=00004000,00000000000000000100000000000000 not ok 51 - File opened with <:encoding(utf8) should return 1 on test crlf # Failed test 'File opened with <:encoding(utf8) should return 1 on test crlf' # at 10-basics.t line 77. # got: '0' # expected: '1' # $VAR1 = [ # "unix", # undef, # [ # "UTF8", # "CANREAD", # "FASTGETS" # ] # ]; # $VAR2 = [ # "crlf", # undef, # [ # "UTF8", # "CANREAD", # "FASTGETS" # ] # ]; # $VAR3 = [ # "encoding", # "utf8", # [ # "UTF8", # "CANREAD", # "FASTGETS" # ] # ]; #### $VAR1 = { "\$fh" => \*{"main::\$fh"}, "\$mode" => "<:encoding(utf8)", "\$result_for{\$test_type}" => 1, "\$test_type" => "crlf" }; FL=00200400,00000000001000000000010000000000 CK=00004000,00000000000000000100000000000000 FL=00404400,00000000010000000100010000000000 CK=00004000,00000000000000000100000000000000