develooper Front page | perl.perl5.porters | Postings from October 2003

Re: CGI::Cookie Warnings

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
October 22, 2003 13:20
Subject:
Re: CGI::Cookie Warnings
Message ID:
20031022222420.6f1f7538.rgarciasuarez@free.fr
Nicholas Clark wrote:
> On Tue, Oct 21, 2003 at 11:20:36PM -0700, David Wheeler wrote:
> > Lincoln,
> > 
> > Under some circumstances with Perl 5.8.1, I get this warning with 
> > CGI::Cookie:
> > 
> >   Ambiguous use of -time resolved as -&time() at 
> > /usr/local/lib/perl5/5.8.1/CGI/Cookie.pm line 223.
> > 
> > I believe that the attached simple patch addresses the issue. I've Cc'd 
> > perl5-porters in the hope that the patch would also make it into the 
> > core before the release of Perl 5.8.2.
> 
> [that bit makes sense to me - if an updated CGI.pm hits CPAN it can
> get assimilated]
> 
> 
> -  $self->{'max-age'} = CGI::Util::expire_calc($expires)-time if defined $expires;
> +  $self->{'max-age'} = CGI::Util::expire_calc($expires) - time if defined $expires;
> 
> Eh? How on earth can whitespace be significant? :-(
> Are you sure you were using perl and not some other language beginning with P?

Whitespace is significant for warnings, at least, based on the heuristics
coded into toke.c.

However whitespace can be significant for parsing either : notably when the
tokenizer tries to intuit something related to the indirect object
notation.

$ perl -wle 'print $foo -time'
Name "main::foo" used only once: possible typo at -e line 1.
Can't use an undefined value as a symbol reference at -e line 1.

$ perl -wle 'print $foo - time'
Name "main::foo" used only once: possible typo at -e line 1.
Use of uninitialized value in subtraction (-) at -e line 1.
-1066854125

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About