Re: [RFC/PATCH] gitweb: Enable transparent compression form HTTP output

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

 



On Sunday, 26 August 2007, Petr "Pasky" Baudis wrote:
> On Sun, Aug 26, 2007 at 12:09:29AM CEST, Jakub Narebski wrote:
>> On Sat, Aug 25, 2007, Petr Baudis wrote:
>>> On Wed, Jul 25, 2007 at 08:39:43PM CEST, Jakub Narebski wrote:
>>> 
>>>> Check if PerlIO::gzip is available, and if it is make it possible to
>>> 
>>> It doesn't really check if the require succeeded. Either the description
>>> or (preferrably, but not a showstopper, IMO) the code should be
>>> adjusted.
>> 
>> It does not check if require succeeded (I could do that this way),
>> but instead checks if $PerlIO::gzip::VERSION is defined (if it is true).

See below for alternate solution.

>> our $enable_transparent_compression = !! $PerlIO::gzip::VERSION;
> 
> Whoops, I completely missed this chunk.
> 
>  Bareword "PerlIO::gzip::VERSION" not allowed while "strict subs" in use at /home/pasky/WWW/repo/gitweb.cgi line 26.

Did you perchance forgot '$' in "$PerlIO::gzip::VERSION"?

But I agree that using

	BEGIN {
        	CGI->compile() if $ENV{'MOD_PERL'};

	        eval { require PerlIO::gzip; }; # needed for transparent compression
		our $enable_transparent_compression = ! $@;
	}
 

instead of

	BEGIN {
        	CGI->compile() if $ENV{'MOD_PERL'};

	        eval { require PerlIO::gzip; }; # needed for transparent compression
	}
 
	our $enable_transparent_compression = !! $PerlIO::gzip::VERSION;
 
is more sensible. I have tried to check the above code for the case when
PerlIO::gzip is not available by using non-existent module "PerlIO::gzp"
in eval, and non-existent variable "$PerlIO::gip::VERSION" in the
definition of $enable_transparent_compression variable, and Perl doesn't
give any errors nor warnings while running gitweb.

But what it is a bit strange, when I have chosen different name for
a variable to test, "$PerlIO::gzip::VERSON" (existing but not loaded
module, non-existent name), I have got the following strange warning:

  gitweb.perl: Name "PerlIO::gzip::VERSON" used only once: possible typo
  at /home/jnareb/git/t/trash/../../gitweb/gitweb.perl line 27.

Strange...

-- 
Jakub Narebski
Poland
-
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