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

Re: FW: File::Find modified to pass arguments to the wanted function (with attachment)

Thread Previous | Thread Next
From:
Gisle Aas
Date:
May 20, 2004 05:41
Subject:
Re: FW: File::Find modified to pass arguments to the wanted function (with attachment)
Message ID:
lriseri83x.fsf@caliper.activestate.com
Mark Jason Dominus <mjd@plover.com> writes:

> hv@crypt.org:
> > Gisle Aas <gisle@ActiveState.com> wrote:
> > :Another option is simply to pass a closure that capture the arguments
> > :you want your callback to receive.  
> > :But again, I think File::Find is fine as it is.
> > 
> > I agree, 
> 
> 
> It's not always convenient to do that.

The sub{} wrapper will seldom be much more typing than providing args
any another way, so I don't find it very inconvenient either.

The Tk-style for providing callback args actually do save a little bit
of typing:

   find([\&foo, $bar], @files);
   find(sub { foo($bar) }, @files);

> I have wondered for a long time why File::Find didn't have this
> feature.

Have anybody ever done a survey of which Perl callback APIs provide
args to be passed back and which do not?  I certainly tend to not
provide a way to pass args that as closures gives enough hooks as it
is.

Regards,
Gisle

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