Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PerlX-QuoteOperator CPAN distribution.

Report information
The Basics
Id: 54531
Status: resolved
Priority: 0/
Queue: PerlX-QuoteOperator

People
Owner: DRAEGTUN [...] cpan.org
Requestors: blade [...] dropfknuck.net
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.01
Fixed in: 0.02



Subject: test fail on Win32
hey there, i've just tried to install PerlX-QuoteOperator, sadly it fails testing on Win32 in qo-URL.t (all tests). It seems that LWP::Simple doesn't understand backslashes\ (as returned by Directory::Scratch) in (at least) file:// URIs. If I add a $url =~ s!\\!/!g; in the test script the file gets correctly fetched. Still, the tests fail, as the result does not match the expected string. I couldn't see any obvious difference and haven't tracked this issue further yet. -blade PS: after a forced install PerlX::QuoteOperator works fine. PPS: Thanks for your work, this is a really great module. os: Microsoft Windows XP [Version 5.1.2600] perl -V: Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT - DPERL_IMPLICIT_CONTE XT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_READFIX', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='3.4.5', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseek size=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C: \strawberry\c\li b"' libpth=C:\strawberry\c\lib libs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool - lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 - lmpr -lwinmm -lversion -lodbc32 -lodbccp32 perllibs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 - lwinspool -lcomdl g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 - lmpr -lw inmm -lversion -lodbc32 -lodbccp32 libc=-lmsvcrt, so=dll, useshrplib=true, libperl=libperl510.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\st rawberry\c\lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO Built under MSWin32 Compiled at Apr 17 2008 11:36:20 @INC: C:/strawberry/perl/lib C:/strawberry/perl/site/lib .
Hi Lionel, Many thanks for spotting this and even more thanks for using my module. Its great to see it being used. I've attached a new qo-URL.t which I hope addresses the two problems related to my use of Directory::Scratch: i) Converting Windows path for LWP file:// ii) Test data now consistent across platforms. I don't have a Windows platform so if you are able to test this then that would be very handy. But don't worry if you you can't because I will upload a new PerlX::QuoteOperator 0.02 to CPAN with this fix by end of week. Kind regards, Barry
Subject: qo-URL.t
#!perl -T use Test::More tests => 3; use Directory::Scratch; use constant WIN32 => $^O eq 'MSWin32'; my $tmpfile = 'qURL'; my $tmp = Directory::Scratch->new; my $file = $tmp->touch( $tmpfile, stuff() ); my $url = 'file://localhost' . sub { return $_[0]->as_foreign('Unix') if WIN32; return $_[0]->stringify; }->( $file ); # default test use PerlX::QuoteOperator::URL; is qURL/$url/, test_stuff(), 'qURL testing file:// content'; # renamed to qh use PerlX::QuoteOperator::URL 'qh'; is qh{$url}, test_stuff(), 'qh testing file:// content'; # re-test default again but with () is qURL($url), test_stuff(), 'qURL() testing file:// content'; # clear up scratch $tmp->delete( $tmpfile ) or diag "Issue removing tmp file ($file)"; undef $tmp; # everything else is removed sub test_stuff { stuff() . "\n" } sub stuff { join "\n", ( "first line of data", "now the second line", "and finally the third line", ); }
Oh and additional to that I've done one further change: iii) Got rid of the "//localhost" as part of URL in case Windows wasn't able to resolve this. I've attached an updated qo-URL.t. Change can also be seen on github repo here: http://github.com/draegtun/PerlX- QuoteOperator/blob/master/t/qo-URL.t regards Barry
Subject: qo-URL.t
#!perl -T use Test::More tests => 3; use Directory::Scratch; use constant WIN32 => $^O eq 'MSWin32'; my $tmpfile = 'qURL'; my $tmp = Directory::Scratch->new; my $file = $tmp->touch( $tmpfile, stuff() ); my $url = 'file:' . sub { return $_[0]->as_foreign('Unix') if WIN32; return $_[0]->stringify; }->( $file ); # default test use PerlX::QuoteOperator::URL; is qURL/$url/, test_stuff(), 'qURL testing file:// content'; # renamed to qh use PerlX::QuoteOperator::URL 'qh'; is qh{$url}, test_stuff(), 'qh testing file:// content'; # re-test default again but with () is qURL($url), test_stuff(), 'qURL() testing file:// content'; # clear up scratch $tmp->delete( $tmpfile ) or diag "Issue removing tmp file ($file)"; undef $tmp; # everything else is removed sub test_stuff { stuff() . "\n" } sub stuff { join "\n", ( "first line of data", "now the second line", "and finally the third line", ); }
Hi Barry, thanks for the reply. Unfortunately your changes won't fix the issues. There seems to be something wrong with Path::Class, as_foreign('Unix') gives me something like 'file://localhost\tmp\fc3_AjmajY/qURL' instead of the correct 'file://localhost/tmp/fc3_AjmajY/qURL'. I'll write bug report to the author of Path::Class after i double checked this issue. After the s!\\!/!g workaround, the test still fails, with the diag looking exactly the same. I suspected line endings when i wrote the bug report, but didn't verify that. This time i did. It looks like during the tempfile's write <-> read cycle line endings get converted from \n to \r\n causing the is () to fail. After i removed all newlines out of the test data the tests succeed (as expected). I attached my version of the test file, maybe it will be of help. Show quoted text
>> ...and even more thanks for using my module. Its great to see it
being used. Actually, i love it. Keep going! greetings. -blade PS: I missed your last update. The //localhost part is fine with windows, my adapted version contains it.
Subject: qo-URL.win32.t
#!perl -T use Test::More tests => 3; use Directory::Scratch; use constant WIN32 => $^O eq 'MSWin32'; my $tmpfile = 'qURL'; my $tmp = Directory::Scratch->new; local $, = '!'; # touch uses the value of $, my $file = $tmp->touch( $tmpfile, stuff() ); my $url = 'file://localhost' . sub { return $_[0]->as_foreign('Unix') if WIN32; return $_[0]->stringify; }->( $file ); $url =~ s!\\!/!g if WIN32; # fixin \ # default test use PerlX::QuoteOperator::URL; is qURL/$url/, test_stuff(), 'qURL testing file:// content'; # renamed to qh use PerlX::QuoteOperator::URL 'qh'; is qh{$url}, test_stuff(), 'qh testing file:// content'; # re-test default again but with () is qURL($url), test_stuff(), 'qURL() testing file:// content'; # clear up scratch $tmp->delete( $tmpfile ) or diag "Issue removing tmp file ($file)"; undef $tmp; # everything else is removed # ! instead of \n sub test_stuff { stuff() . "!" } sub stuff { join "!", ( "first line of data", "now the second line", "and finally the third line", ); }
Hi Lionel, Its a shame that as_foreign didn't do the trick :( It maybe a bug in Path::Class or its just me misunderstanding what its really suppose to be doing! Your attached test file worked here on Unix (OS X) so I've gone with this as part of a new 0.02 PerlX::QuoteOperator which I just uploaded to CPAN. Many thanks for all your help on this. regards Barry