Thread (10 messages) flat view 10 messages, 4 authors, 2016-06-15

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

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:43:31

On Sunday, 26 August 2007, Petr "Pasky" Baudis wrote:
On Sun, Aug 26, 2007 at 12:09:29AM CEST, Jakub Narebski wrote:
quoted
On Sat, Aug 25, 2007, Petr Baudis wrote:
quoted
On Wed, Jul 25, 2007 at 08:39:43PM CEST, Jakub Narebski wrote:
quoted
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.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help