On Monday 01 Mar 2010 15:00:26 raphael() wrote:
> On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey <shawnhco...@gmail.com> wrote:
> > raphael() wrote:
> > > Hi,
> > > 
> > > How can I stop File::Find to go below current dir? i.e. no recursion.
> > > 
> > > Although I can use glob or <*> to get file names in current dir.
> > > But I wanted to know if File::Find has a maxdepth limit like linux
> > 
> > "find".
> > 
> > > The script I created uses a switch which decides if recursion is
> > > allowed
> > 
> > or
> > 
> > > not.
> > > It uses the system find like this..
> > > 
> > > open(FIND, "find -maxdepth $recursive |" );
> > > 
> > > I wanted to remove this dependency on system find. Is it possible with
> > > File::Find?
> > > 
> > > I tried this after googling
> > > 
> > > http://www.perlmonks.org/?node_id=676958
> > > 
> > > sub wanted
> > > {
> > > 
> > >     if ( -d ) { # should I write this as -d $File::Find::name
> > 
> > # No, this is shorthand for:
> >    if( -d $_ ){
> >    
> > >           $File::Find::prune = 1;
> > >           return;
> > >     
> > >     }
> > >     print $File::Find::name . "\n";
> > > 
> > > }
> > 
> > And didn't it work?  The if statement works on all directories.  This
> > means that all directories except the top-level one will not be searched.
> > 
> > 
> > --
> > Just my 0.00000002 million dollars worth,
> > 
> >  Shawn
> > 
> > Programming is as much about organization and communication
> > as it is about coding.
> > 
> > I like Perl; it's the only language where you can bless your
> > thingy.
> > 
> > Eliminate software piracy:  use only FLOSS.
> 
> Nope. It ddn't work. Any ideas?
> I am thinking to use File::Find::Rule. But I didn't want any module
> dependency for this script.

You can look at how File::Find::Rule does it and duplicate the logic.

> 
> And Shlomi your message came in while I was typing this. Going to check the
> modules you mentioned.

Thanks.

> But it would have been great if I didn't has to use a module :( The people
> around me no sh*t about installing perl
> modules from CPAN.

Well, Matt S. Trout shared his sentiments about "I cannot use CPAN" here:

http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/

I've placed a link to it here:

http://perl-begin.org/topics/cpan/

> 
> Thanks all.
> 
> PS - Shlomi, your website is GOOD!

Thanks for the compliment! If possible, please share it with your friends and 
on social-bookmarking/social-networks/etc. sites that you belong to.

BTW, you shoulnd't highlight words using all-uppercase-letters. (It's 
considered akin to shouting). Instead use *...* , /.../ or _..._ .

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to