Skip Menu |

This queue is for tickets about the App-FatPacker CPAN distribution.

Report information
The Basics
Id: 124048
Status: new
Priority: 0/
Queue: App-FatPacker

People
Owner: Nobody in particular
Requestors: knth [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.010007
Fixed in: (no value)



Subject: PATCH: Making it work on Windows...
The below was done with App::FatPacker 0.010007 and various (late; 5.24+) variants of Strawberry and ActivePerl and a very simple script. The patch below addresses the problems below. It should be noted that the tests actually pass on Windows but the end result does in fact not work. 1) The packlists-for doesn't find any packlists. This is due to not normalizing paths in some locations to account for / vs \. Solved by adding a simple method that 'slashifies' and using it in those locations. This is transparent on Unix/Linux. 2) The suggested command styles of 'fatpack packlists-for $(cat fatpacker.trace)' and similar for 'fatpack tree $(cat packlists)' obviously doesn't work in Windows so I added a mechanism to allow passing it via stdin in case argv is empty, e.g. 'fatpack packlists-for <fatpacker.trace)'. This should also be transparent (but equally useful, and perhaps better) on Unix/Linux. 3) The algorithm for finding $pack_base is assuming a tree layout that isn't true on Windows (or more correctly, at least not for the strawberry and activeperls I've used). The end result is that the packed modules gets pathnames as 'lib/Foo/Bar' instead of the correct 'Foo/Bar'. As the original code rests on guesswork, I made a very ugly fix to adjust the offset by one...feel free to do better :-) The patch: diff -r App-FatPacker-0.010007/lib/App/FatPacker.pm App-FatPacker-0.010007.hack/lib/App/FatPacker.pm 34a35,41 Show quoted text
> sub slashify { > my $p = shift; > my $sep = shift || ($^O eq 'MSWin32' ? '\\' : '/'); > $p =~ s#[/\\]+#$sep#g; > return $p; > } >
137a145 Show quoted text
> chomp(@$args = <STDIN>) unless @$args;
163c171 < $pack_rev{$_} = $File::Find::name for lines_of $File::Find::name; --- Show quoted text
> $pack_rev{slashify($_)} = $File::Find::name for lines_of $File::Find::name;
166c174 < my %found; @found{map +($pack_rev{Cwd::abs_path($INC{$_})}||()), @targets} = (); --- Show quoted text
> my %found; @found{map +($pack_rev{slashify(Cwd::abs_path($INC{$_}))}||()), @targets} = ();
171a180 Show quoted text
> chomp(@$args = <STDIN>) unless @$args;
189a199 Show quoted text
> $version_lib -= 1 if $^O eq 'MSWin32'; # Ugly for now - seems to work for Strawberry and ActivePerl