In <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
wrote
>
> John W. Krahn wrote:
> >
> > Stephen wrote:
> >
> > > 4. Maybe I'm restating the above question, but in addition to the
> > > &wanted sub, File::find accommodates process, etc., as well. When/how
> > > can these are typically used?
> >
> > Sorry, I've never used them.
>
> You can specify 'preprocess' and 'postprocess' routines with the alternate
> form of the call to 'find', with an anonymous hash as the first parameter
> instead of a code reference. Like this:
>
> find( {
> wanted => \&wanted,
> preprocess = \&preprocess,
> postprocess = \&postprocess,
> }, 'C:/SomeFolder');
>
Starting to make sense. Just a small question, though. The use of \&
before the sub name -- my understanding is that the "\" character is
used as an escape, the "&" character defines a sub (but is regularly
omitted), and the format for calling a sub is "sub_name ()" rather than
"&sub_name ()". If that's correct, why is "\&" being used in the hash?
> In essence, what File::Find does is
>
> - Read a file directory
>
> - If 'postprocess' is specified then the subroutine is called with
> the list of files as parameters. The subroutine must then return
> a list of those files it is interested in.
>
> - The 'wanted' subroutine is called for each member of the list
> with the file name as a parameter.
>
> - If the 'postprocess' subroutine is specified then it is called
> with no parameters.
>
> - If any of the files in the list were directories then this process
> process recurses for each of them.
>
> There's a little more to it than that but that's the basics.
I'm sure there's a lot more to it <g>, but I think I get it now. So
that I can stop my headscratching, can you provide an example of a
script where both wanted and postprocess functions are used?
>
> HTH,
>
> Rob
>
Thanks again for the all help.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]