Click here to get back home

explain code section please...

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
explain code section please... onlineviewer 08-28-2006
Posted by onlineviewer on August 28, 2006, 9:06 pm
Please log in for more thread options


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


Posted by onlineviewer on August 28, 2006, 9:09 pm
Please log in for more thread options


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


Similar ThreadsPosted
Does "my" vs "our" explain this problem? February 8, 2006, 11:01 am
ANNOUNCE: Code::Dumper - a ::Dumper for code. Available on CPAN November 21, 2005, 11:03 am
Please help with this code June 10, 2007, 3:40 pm
what is wrong in this code November 13, 2005, 10:40 pm
Image Magick code help November 29, 2004, 12:14 pm
Image Magick code help December 3, 2004, 6:43 pm
Net::Cmd::code doesn't return value of Net::Cmd::dataend January 10, 2005, 9:17 pm
encode the perl code September 6, 2006, 1:12 am
Using a DBI connection in many places (in the code) August 4, 2008, 4:39 am
best module to parse / modify C-code October 7, 2005, 1:27 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap