Subject: | modules using Class::Interface wrote on W7 fail on Linux |
Date: | Fri, 4 Dec 2015 13:31:50 +0000 |
To: | "bug-Class-Interface [...] rt.cpan.org" <bug-Class-Interface [...] rt.cpan.org> |
From: | RAPPAZ Francois <francois.rappaz [...] unifr.ch> |
Hi
I'm on W7 with perl 5.20, and I use Class::Interface 1.01 without problems. I made a bunch of modules and saw reports from CPAN tester stating
PERL_DL_NONLAZY=1 "/bbbike/perl-5.23.4/bin/perl5.23.4" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Gtk2::Ex::DbLinker::DbiDataManager tries to implement non existing interface Gtk2::Ex::DbLinker::AbDataManager -- Gtk2::Ex::DbLinker::AbDataManager is not a valid interface. set_row_pos; has an implementation at /opt/perl-5.23.4/lib/site_perl/5.23.4/Gtk2/Ex/DbLinker/AbDataManager.pm line 7.
Compilation failed in require at (eval 7) line 1.
My AbDataManager.pm looks like
package Gtk2::Ex::DbLinker::AbDataManager;
use Gtk2::Ex::DbLinker::DbTools;
our $VERSION = $Gtk2::Ex::DbLinker::DbTools::VERSION;
use Class::Interface;
&interface();
use strict;
use warnings;
sub set_row_pos;
etc....
In your source file I saw that :
$line =~ s/\ +$//;
my ($sub) = $line =~ /sub ([^\s]+)/;
my $lineEnd = substr( $line, length($line) - 1 );
if ( $lineEnd ne ";" and $lineEnd ne "}" ) {
# if this is an abstract, implementations are OK
next if $asAbstract;
# ai. The sub has an implementation
error
"$interface is not a valid interface. $sub has an implementation";
}
I suspect that the problem is with how $lineEnd is defined: on W7 ends of lines are 2 characters and removing one still keep the carriage return. So the test fails.
I have saved my file with unix line ending but the code above should take into account that a file could be produced on w7 and test on linux
What about doing
$line =~ s/\r|\n//g;
Thanks
François