develooper Front page | perl.perl5.porters | Postings from May 2015

Re: [perl #123475] Bleadperl v5.21.6-51-ge41e986 breaks BDB

Thread Previous
From:
Dave Mitchell
Date:
May 6, 2015 11:04
Subject:
Re: [perl #123475] Bleadperl v5.21.6-51-ge41e986 breaks BDB
Message ID:
20150506110327.GT4035@iabyn.com
On Tue, May 05, 2015 at 04:33:21PM +0100, Dave Mitchell wrote:
> On Mon, Apr 27, 2015 at 03:15:34PM -0700, Ricardo SIGNES via RT wrote:
> > I can't easily compile BDB here.  Is the fix as simple as changing the
> > PROTOTYPE entry for set_sync_prepare in BDB.xs to ";&" ?
> 
> Not really. It would also have to change the XS implementation to handle
> a variable number of args, and still wouldn't handle the case of an
> explicit 'undef' arg.
> 
> Looking at the usage in BDB, I think an undef value should still be
> allowed as an argument to a '&' parameter.
> 
> BDB.pm does this as part of its initialisation:
> 
>     set_sync_prepare (undef);
> 
> where set_sync_prepare() is used to register a callback. So in this case
> it is explicitly initialising its state to "no callback registered". I
> think this is a reasonable use of the & prototype.
> 
> Looking at the original '&' ticket,
> 
>     #123062: & prototype is too permissive
> 
> I think it's correct that it should dis-allow array refs etc, but I think
> undef should be re-allowed for 5.22.

If no one objects, I'll merge the following commit once it's smoked:

commit 343d03e768e8a0fd8d9aca836df191d819f4e3e8
Author:     David Mitchell <davem@iabyn.com>
AuthorDate: Wed May 6 11:56:47 2015 +0100
Commit:     David Mitchell <davem@iabyn.com>
CommitDate: Wed May 6 12:01:06 2015 +0100

    allow undef as an arg to '&' prototype
    
    RT #123475
    
    Commit e41e9865be5555 (to fix [perl #123062]) restricted the types of
    args allowed for a function with a '&' prototype - previously it allowed
    array refs and the like. It also removed undef, so this was now a
    compile-time error:
    
        sub foo (&) {...}
        foo(undef)
    
    However, some CPAN code used the idiom register_callback(undef) to
    explicitly disable a registered callback.
    
    So re-allow an explicit undef.




-- 
print+qq&$}$"$/$s$,$a$d$g$s$@$.$q$,$:$.$q$^$,$@$a$~$;$.$q$m&if+map{m,^\d{0\,},,${$::{$'}}=chr($"+=$&||1)}q&10m22,42}6:17a2~2.3@3;^2dg3q/s"&=~m*\d\*.*g

Thread Previous


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