On Mon, 23 Apr 2012 06:02:55 +0000
Jack Maney <[email protected]> wrote:
> Manfred,
>
> The issue is that you're storing the return value of the start method
> into $plf, and if you look at the source code, the start method
> returns 1.
>
> In fact, using Data::Dumper,
>
> print Dumper($plf) . "\n";
>
> returns
>
> $VAR1 = 1;
>
> The start method is a method that doesn't return anything important,
> but manipulates things for other methods to use. What you want to do
> instead is set up the rules for $plf and then call the start method
> separately:
>
I see. In meantime Shlomi adjusted the code to the documetation which
makes it very convenient to work with the package.
> use strict;
> use warnings;
>
> use Data::Dumper;
>
> use File::Find::Object::Rule ;
>
> my $plf = File::Find::Object::Rule->file->name("*.pl");
> $plf->start("./");
>
> while ( my $perl_file = $plf->match ){
> print "$perl_file\n";
> }
>
>
> If you're familiar with DBI, you can think of $plf as a statement
> handle, setting up the rules ('->file->name("*.pl")', etc) as
> analogous to DBI's prepare method, and start as analogous to execute.
>
No, I'm not familiar with DBI.
Thanks for your help.
--
Manfred
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/