Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: File::System recursion

by mpeever (Friar)
on Oct 29, 2008 at 20:50 UTC ( [id://720333]=note: print w/replies, xml ) Need Help??


in reply to File::System recursion

Is there any particular reason you're not using File::Find to do the tree walking?

Replies are listed 'Best First'.
Re^2: File::System recursion
by koaps (Novice) on Oct 29, 2008 at 22:41 UTC
    I figured if all directories found where returned as objects by File::System::Object, then I can easily create several files within the different objects, verifying content(with md5 maybe) and doing several other operations the File::System::Object has methods for, move, copy, delete, etc.

      OK, I think I understand a little better what you were trying to accomplish.

      This seems to correctly return all the files in the File::System in a hash of hashes:

      #!/usr/bin/perl use strict; use Data::Dumper; use File::Find; use File::System; my $root = File::System->new( "Real", root => '/etc' ); my %files = map { my $file = $_; my %attrs = map { $_ => $file->get_property($_); } ( $_->propertie +s() ); $file => \%attrs; } $root->find( sub { 1 }, () ); print Dumper \%files;
      I realise that doesn't completely do what you want, but it seems to at least get the complete file tree back, without empty hashes...

      To be perfectly honest, I generally use File::Find out of a sense of guilt: I really prefer the interface from File::System::Object $obj -> find()

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://720333]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2026-05-11 03:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.