Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[10744] branches/sympa-6.2-branch/src/lib/cookielib.pm: [-dev] typo.

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[10744] branches/sympa-6.2-branch/src/lib/cookielib.pm: [-dev] typo.
  • Date: Tue, 3 Jun 2014 13:40:03 +0900

Hi,

I found a similar misuse.

On Thu, 29 May 2014 01:12:59 +0900
IKEDA Soji <address@concealed> wrote:

> On Wed, 28 May 2014 13:33:44 +0200
> Guillaume Rousse <address@concealed> wrote:
>
> > Le 26/05/2014 04:41, address@concealed a écrit :
> > > Log Message
> > >
> > > [-dev] typo.
> > [..]
> > > --- branches/sympa-6.2-branch/src/lib/cookielib.pm 2014-05-25
> > > 22:31:25 UTC (rev 10743)
> > > +++ branches/sympa-6.2-branch/src/lib/cookielib.pm 2014-05-26
> > > 02:41:22 UTC (rev 10744)
> > > @@ -154,7 +154,7 @@
> > > return ($cookie->value);
> > > }
> > > }
> > > - return;
> > > + return undef;
> > > }
> > That's hardly a typo, and using an explicit 'return undef' statement is
> > even considered a wrong practice (rating 5 in perlcritic) over a raw
> > 'return' statement (because it will return a true value in list context,
> > for the details).
> >
> > It's however more consistent with current usage in our code base.
>
> I had agreed to this opinoion, however, I found it risky to use
> 'return' statement with "void context".
>
> For example,
>
> a_subroutine(generic_get_cookie(...), other_parameters, ...);
>
> Where, if generic_get_cookie() returns with void "return", it is
> executed as
>
> a_subroutine(other_parameters, ...);
>
> when a subroutine a_subroutine() wasn't forced any prototypes.
>
> So I decided not to use "void return" statement unless the
> subroutine returns an array under array context.

List.pm:

|sub dump {
...
| $self->{'mtime'} = [
| (stat("$self->{'dir'}/config"))[9],
| (stat("$self->{'dir'}/subscribers"))[9],
| (stat("$self->{'dir'}/stats"))[9]
| ];
...

The "subscribers" file was deprecated: It may not exist.
OTOH stat() returns void (empty array) when the file is not found.
In addition, (...)[9] is not the scalar: It is array slice.

As a result, we fail to find modification time of "stats" file.


Regards,

--- Soji

--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/


  • Re: [sympa-developpers] [sympa-commits] sympa[10744] branches/sympa-6.2-branch/src/lib/cookielib.pm: [-dev] typo., IKEDA Soji, 06/03/2014

Archive powered by MHonArc 2.6.19+.

Top of Page