[PATCH/gitweb-caching] perl/: fix optional argument handling in _load methods

From: Christian Jaeger <hidden>
Date: 2016-06-15 22:45:40
Subsystem: the rest · Maintainer: Linus Torvalds

Perl's 'shift' only ever delivers the first of all subroutine/method
arguments, meaning that $self would be assigned a value but $raw_text
would always remain undef even if an argument would have been passed
to the method.

Signed-off-by: Christian Jaeger <redacted>
---
 This is a fix for the code in git://repo.or.cz/git/gitweb-caching.git

 perl/Git/Commit.pm |    3 ++-
 perl/Git/Tag.pm    |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/perl/Git/Commit.pm b/perl/Git/Commit.pm
index ee87e11..6ed076b 100644
--- a/perl/Git/Commit.pm
+++ b/perl/Git/Commit.pm
@@ -141,7 +141,8 @@ sub encoding {
 # The raw contents of the commit object; the commit object will be
 # retrieved from the repository if that parameter is not given.
 sub _load {
-	my ($self, $raw_text) = shift;
+	my $self = shift;
+	my ($raw_text)=@_;
 	return if exists $self->{message};  # already loaded
 
 	my $sha1 = $self->sha1;
diff --git a/perl/Git/Tag.pm b/perl/Git/Tag.pm
index 5622431..e1f1201 100644
--- a/perl/Git/Tag.pm
+++ b/perl/Git/Tag.pm
@@ -132,7 +132,8 @@ sub encoding {
 # The raw contents of the tag object; the tag object will be retrieved
 # from the repository if that parameter is not given.
 sub _load {
-	my ($self, $raw_text) = shift;
+	my $self = shift;
+	my ($raw_text)=@_;
 	return if exists $self->{message};  # already loaded
 
 	my $sha1 = $self->sha1;
-- 
1.6.0.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help