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

io->catfile( $io, $str ) fails on windows #74

Closed
samuelckaufman opened this issue Jan 17, 2015 · 10 comments
Closed

io->catfile( $io, $str ) fails on windows #74

samuelckaufman opened this issue Jan 17, 2015 · 10 comments

Comments

@samuelckaufman
Copy link

use strict;                              
use warnings FATAL => 'all';             

BEGIN {                                  
    $^O = 'MSWin32';                     
};                                       

use IO::All;                             
io->catfile( io->dir('/'), 'test.json' );

Operation "eq": no method found,
    left argument in overloaded package IO::All::Dir,
    right argument has no overloaded magic at /home/skaufman/perl5/perlbrew/perls/perl-5.20.0/lib/5.20.0/x86_64-linux/File/Spec/Win32.pm line 135.

Also see: http://www.cpantesters.org/cpan/report/608781a5-9264-1014-8cee-01022b825c07
For when that bug shows up from another package.

Googling around I found: http://www.nntp.perl.org/group/perl.beginners/2005/04/msg74371.html
Which somewhat suggests that overloading "" is not enough, you may have to overload 'eq' as well. That seems odd to me, but maybe.

@samuelckaufman
Copy link
Author

skaufman@yibberdibber:~ $ perl -MFile::Spec::Win32 -e 'warn File::Spec::Win32->VERSION'
3.47 at -e line 1.

@samuelckaufman
Copy link
Author

adding use overload 'eq' => '_overload_stringify'; to IO::All fixes it, haarg suggested adding a fallback to _overload_stringify.

xlat added a commit to xlat/io-all-pm that referenced this issue Apr 30, 2015
@xlat
Copy link
Contributor

xlat commented Apr 30, 2015

Would'nt it be better to add a cmp overload?

@samuelckaufman
Copy link
Author

@xlat as long as it fixes the 'Operation "eq": no method found' I'm happy. The answer to your question as far as I'm concerned is if overloading cmp overloads eq by proxy then sure, that would be better.

@xlat
Copy link
Contributor

xlat commented May 1, 2015

@ediblenergy yes, it looks like to be the case if you take a look at the first test I have added to overload.t ;)

@samuelckaufman
Copy link
Author

Ah cool now I see it, looks good to me :) I'll ping in #io-all because github notifications are terrible.

@frioux
Copy link
Collaborator

frioux commented May 4, 2015

I'll try to get a fix released for this soonish; thanks for the research all!

@wesQ3
Copy link

wesQ3 commented Jul 18, 2017

I have this issue as well on Windows using ->relative($path).

perl -MCarp::Always -E "use IO::All; my $p = io->dir('C:\Inetpub\log');
 my $f =  $p->file('06-30-2017.txt'); say $f->relative($p)"

Operation "eq": no method found,
        left argument in overloaded package IO::All::Dir,
        right argument has no overloaded magic at C:/Inetpub/lynx/strawberry/perl/site/lib/File/Spec/Win32.pm line 186.
        File::Spec::Win32::canonpath("File::Spec", IO::All::Dir=GLOB(0x3faf3c)) called at C:/Inetpub/lynx/strawberry/perl/site/lib/File/Spec/Unix.pm line 414
        File::Spec::Unix::abs2rel("File::Spec", "..\\..\\log\\06-30-2017.txt", IO::All::Dir=GLOB(0x3faf3c)) called at C:/Inetpub/lynx/strawberry/perl/site/lib/IO/All/Filesys.pm line 77
        IO::All::Filesys::relative(IO::All::File=GLOB(0x228a354), IO::All::Dir=GLOB(0x3faf3c)) called at -e line 1

@frioux
Copy link
Collaborator

frioux commented Jul 18, 2017

Wes told me he'd write a test; I'll incorporate one of the fixes above, have him ensure that the test passes on win32 (and ofc I'll run on linux) and then I'll cut a rel.

@wesQ3
Copy link

wesQ3 commented Jul 19, 2017

This is resolved in the 0.87 release and can be closed.

@frioux frioux closed this as completed Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants