git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: squelch harmless variable scoping errors

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2009, 18:40 UTC
Message-ID
<7vvdkygne3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<F203660D-5123-475D-8288-F398EA670002@mailservices.uwaterloo.ca>
Mark A Rada <marada@uwaterloo.ca> writes:
Show 5 quoted lines
> I fiddled around a bit and this solution seems to work, but is a bit
> odd, as the method is declared obsolete in the Perl documentation
> (v5.8.8).
>
> What do you think?
I'd prefer to summon our resident Perl expert ;-)
Show 45 quoted lines
> --
> Mark A Rada (ferrous26)
> marada@uwaterloo.ca
>
>
> --->8---
> This will use the 'vars' method of declaring global variables instead
> of the 'our' method.
>
> Though 'vars' has been obsoleted, it has the advantage of pre-declaring
> global symbols; this ensures that those symbols will be available to
> routines loaded later, whereas 'our' does not seem to do this.
>
> The result is that when using mod_perl you will no longer get any
> warnings printed to your error_log.
>
> Signed-off-by: Mark Rada <marada@uwaterloo.ca>
> ---
> gitweb/gitweb.perl |    8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 37120a3..0544aa2 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -57,12 +57,14 @@ if ($path_info) {
> our $GIT = "++GIT_BINDIR++/git";
>
> # absolute fs-path which will be prepended to the project path
> -#our $projectroot = "/pub/scm";
> -our $projectroot = "++GITWEB_PROJECTROOT++";
> +use vars qw($projectroot);
> +#$projectroot = "/pub/scm";
> +$projectroot = "++GITWEB_PROJECTROOT++";
>
> # fs traversing limit for getting project list
> # the number is relative to the projectroot
> -our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
> +use vars qw($project_maxdepth);
> +$project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
>
> # target of the home link on top of all pages
> our $home_link = $my_uri || "/";
> -- 
> 1.6.4
Previous: Mark A RadaNext: Jakub Narebski
Message 2 of 3 in “gitweb: squelch harmless variable scoping errors”
  1. gitweb: squelch harmless variable scoping errorsMark A Rada, Aug 8, 2009
  2. Junio C HamanoAug 8, 2009
  3. Jakub NarebskiAug 10, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.