{"thread":{"id":"16410","subject":"[PATCH/gitweb-caching] perl/: fix optional argument handling in _load methods","startedAt":"2008-11-20T12:41:36Z","lastAt":"2008-11-20T12:41:36Z","messageCount":1,"participants":["Christian Jaeger"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"96229","messageId":"38041638267157ade226b396cbd960890bc4efd3.1227185278.git.christian@jaeger.mine.nu","threadId":"16410","inReplyTo":null,"subject":"[PATCH/gitweb-caching] perl/: fix optional argument handling in _load methods","fromName":"Christian Jaeger","fromEmail":"christian@jaeger.mine.nu","sentAt":"2008-11-20T12:41:36Z","receivedAt":"2008-11-20T12:41:36Z","isPatch":true,"sender":{"key":"christian@jaeger.mine.nu","avatar":null},"body":"Perl's 'shift' only ever delivers the first of all subroutine/method\narguments, meaning that $self would be assigned a value but $raw_text\nwould always remain undef even if an argument would have been passed\nto the method.\n\nSigned-off-by: Christian Jaeger <christian@jaeger.mine.nu>\n---\n This is a fix for the code in git://repo.or.cz/git/gitweb-caching.git\n\n perl/Git/Commit.pm |    3 ++-\n perl/Git/Tag.pm    |    3 ++-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git/Commit.pm b/perl/Git/Commit.pm\nindex ee87e11..6ed076b 100644\n--- a/perl/Git/Commit.pm\n+++ b/perl/Git/Commit.pm\n@@ -141,7 +141,8 @@ sub encoding {\n # The raw contents of the commit object; the commit object will be\n # retrieved from the repository if that parameter is not given.\n sub _load {\n-\tmy ($self, $raw_text) = shift;\n+\tmy $self = shift;\n+\tmy ($raw_text)=@_;\n \treturn if exists $self->{message};  # already loaded\n \n \tmy $sha1 = $self->sha1;\ndiff --git a/perl/Git/Tag.pm b/perl/Git/Tag.pm\nindex 5622431..e1f1201 100644\n--- a/perl/Git/Tag.pm\n+++ b/perl/Git/Tag.pm\n@@ -132,7 +132,8 @@ sub encoding {\n # The raw contents of the tag object; the tag object will be retrieved\n # from the repository if that parameter is not given.\n sub _load {\n-\tmy ($self, $raw_text) = shift;\n+\tmy $self = shift;\n+\tmy ($raw_text)=@_;\n \treturn if exists $self->{message};  # already loaded\n \n \tmy $sha1 = $self->sha1;\n-- \n1.6.0.4\n"}]}