Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binmode is unimplemented - cannot use File::Copy with Test::MockFile #176

Closed
atoomic opened this issue Mar 21, 2022 · 2 comments
Closed

Comments

@atoomic
Copy link
Contributor

atoomic commented Mar 21, 2022

noticed this while using File::Copy::copy

#!perl

use strict;
use warnings;

use Test::MockFile 0.032;

use File::Copy;

use constant FILE_1 => q[/one];
use constant FILE_2 => q[/two];

my $mock_one = Test::MockFile->file( FILE_1, q[some content] );
my $mock_two = Test::MockFile->file( FILE_2 );

File::Copy::copy( FILE_1, FILE_2 );

error output

Unimplemented at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/Test/MockFile/FileHandle.pm line 361.
	Test::MockFile::FileHandle::BINMODE(Test::MockFile::FileHandle=HASH(0x1b74610)) called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/532/File/Copy.pm line 151
	File::Copy::copy("/one", "/two") called at t/elevate-marker.t line 16
@atoomic
Copy link
Contributor Author

atoomic commented Mar 21, 2022

extract from File::Copy around this line, notice the binmode call

     my $from_h;
     if ($from_a_handle) {
        $from_h = $from;
     } else {
        open $from_h, "<", $from or goto fail_open1;
        binmode $from_h or die "($!,$^E)";
        $closefrom = 1;
     }

@toddr
Copy link
Member

toddr commented Apr 25, 2022

FTR the code is always binmode. technically it's whatever the heck the existing SV is. this can also mess up seek...

@toddr toddr closed this as completed in 1c6bd7f Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants