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

1 messages from 2008-11-20 to 2008-11-20. Participants: Christian Jaeger.
Thread: https://gitlist.dev/t/16410

## Christian Jaeger, 2008-11-20 12:41

Subject: [PATCH/gitweb-caching] perl/: fix optional argument handling in _load methods
Message-ID: <38041638267157ade226b396cbd960890bc4efd3.1227185278.git.christian@jaeger.mine.nu>
URL: https://gitlist.dev/e/38041638267157ade226b396cbd960890bc4efd3.1227185278.git.christian%40jaeger.mine.nu

```
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@jaeger.mine.nu>
---
 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

```
