[libmoo-perl] 02/43: more correct inline module code for 5.6
gregor herrmann
gregoa at debian.org
Mon Dec 26 17:56:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository libmoo-perl.
commit dc80bf7eeeba0b67be842918985b5d68301ca2c9
Author: Graham Knop <haarg at haarg.org>
Date: Tue Jun 28 12:47:29 2016 -0400
more correct inline module code for 5.6
---
t/lib/InlineModule.pm | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/t/lib/InlineModule.pm b/t/lib/InlineModule.pm
index 8802a5a..388b21f 100644
--- a/t/lib/InlineModule.pm
+++ b/t/lib/InlineModule.pm
@@ -36,12 +36,15 @@ sub inc_module {
return $fh;
}
else {
- return sub {
- return 0 unless length $code;
- $code =~ s/^([^\n]*\n?)//;
- $_ = $1;
+ my $pos = 0;
+ my $last = length $code;
+ return (sub {
+ return 0 if $pos == $last;
+ my $next = (1 + index $code, "\n", $pos) || $last;
+ $_ .= substr $code, $pos, $next - $pos;
+ $pos = $next;
return 1;
- };
+ });
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoo-perl.git
More information about the Pkg-perl-cvs-commits
mailing list