{"thread":{"id":"26611","subject":"[PATCH] git-instaweb: Change how gitweb.psgi is made runnable as standalone app","startedAt":"2011-02-26T22:32:33Z","lastAt":"2011-02-27T01:56:48Z","messageCount":2,"participants":["Jakub Narebski","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"162327","messageId":"20110226223142.5944.31865.stgit@localhost.localdomain","threadId":"26611","inReplyTo":null,"subject":"[PATCH] git-instaweb: Change how gitweb.psgi is made runnable as standalone app","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-02-26T22:32:33Z","receivedAt":"2011-02-26T22:32:33Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"According to blog post \"FindBin, __FILE__, $0 and PSGI woes\"\n\n  http://bulknews.typepad.com/blog/2011/02/findbin-__file__-0-and-psgi-woes.html\n\nby Tatsuhiko Miyagawa, using 'if (__FILE__ eq $0)' in .psgi code\n(to check if script was run from command line), is not supposed to work\nsince Plack 0.9971.\n\nReplace it with one of proposed solutions; while at it return $app\nexplicitely, rather than implicitely by being a last expression.\n\nThis affects 'plackup' web server.\n\n\nWhile at it cleanup whitespace.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n git-instaweb.sh |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 10fcebb..86892f7 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -558,12 +558,14 @@ my \\$app = builder {\n \n # make it runnable as standalone app,\n # like it would be run via 'plackup' utility\n-if (__FILE__ eq \\$0) {\n+if (caller) {\n+\treturn \\$app;\n+} else {\n \trequire Plack::Runner;\n \n \tmy \\$runner = Plack::Runner->new();\n \t\\$runner->parse_options(qw(--env deployment --port $port),\n-\t\t\t       \"$local\" ? qw(--host 127.0.0.1) : ());\n+\t                        \"$local\" ? qw(--host 127.0.0.1) : ());\n \t\\$runner->run(\\$app);\n }\n __END__\n"},{"id":"162335","messageId":"20110227015648.GA26643@dcvr.yhbt.net","threadId":"26611","inReplyTo":"20110226223142.5944.31865.stgit@localhost.localdomain","subject":"Re: [PATCH] git-instaweb: Change how gitweb.psgi is made runnable as standalone app","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-02-27T01:56:48Z","receivedAt":"2011-02-27T01:56:48Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Jakub Narebski <jnareb@gmail.com> wrote:\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n\nAll looks reasonable to me (untested)\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n"}]}