Re: explain code section please...
- From: "onlineviewer" <lancerset@xxxxxxxxx>
- Date: 28 Aug 2006 18:06:22 -0700
thx,
John W. Krahn wrote:
onlineviewer wrote:
John W. Krahn wrote:
onlineviewer wrote:
Can someone please explain this code section to me. This is from the
O'reilly book. learning objects,references. I see the end result, but i
am not sure how and in what order it runs. I see that the $callback
variable is a reference to the subroutine,
'create_find_callback_that_sums_the_size'
Wrong. $callback is a reference to an anonymous sub that is CREATED by
'create_find_callback_that_sums_the_size'.
perldoc -q closure
then the find method is
called with the $callback reference and the bin directory.
Correct.
Then the
subroutine executes on each of the contents of the bin directory. Is
that right so far ?? Thanks...
File::Find::find traverses the directory tree starting at 'bin' and for each
entry it calls the subroutine supplied by you and puts the name of that entry
in the $_ variable.
Thanks for the replies, it is very helpful. One more question, is the
subroutine called for as many elements that there are in the bin
directory,
Yes.
or is the subroutine being invoked only once and the
contents of bin are being copied into the subroutine to be worked on
No.
John
--
use Perl;
program
fulfillment
.
- References:
- explain code section please...
- From: onlineviewer
- Re: explain code section please...
- From: John W. Krahn
- Re: explain code section please...
- From: onlineviewer
- Re: explain code section please...
- From: John W. Krahn
- explain code section please...
- Prev by Date: Re: explain code section please...
- Next by Date: Re: explain code section please...
- Previous by thread: Re: explain code section please...
- Next by thread: Re: explain code section please...
- Index(es):
Relevant Pages
|
|