From: Graham Knop Date: Tue, 21 Jul 2015 11:17:44 +0000 (-0400) Subject: fix fatpacking for 5.6 X-Git-Tag: v0.010005~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=11416666a612d4ec7f47805b6b859ed93f2f099d;p=p5sagit%2FApp-FatPacker.git fix fatpacking for 5.6 --- diff --git a/lib/App/FatPacker.pm b/lib/App/FatPacker.pm index d1645e2..8c77d20 100644 --- a/lib/App/FatPacker.pm +++ b/lib/App/FatPacker.pm @@ -278,15 +278,17 @@ sub fatpack_end { if ($] < 5.008) { *{"${class}::INC"} = sub { - if (my $fat = $_[0]{$_[1]}) { - return sub { - return 0 unless length $fat; - $fat =~ s/^([^\n]*\n?)//; - $_ = $1; - return 1; - }; - } - return; + if (my $fat = $_[0]{$_[1]}) { + my $pos = 0; + my $last = length $fat; + return (sub { + return 0 if $pos == $last; + my $next = (1 + index $fat, "\n", $pos) || $last; + $_ .= substr $fat, $pos, $next - $pos; + $pos = $next; + return 1; + }); + } }; }