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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <christian@xxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux