GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  FILE::SLURP::TREE (3)

.ds Aq ’

NAME

File::Slurp::Tree - slurp and emit file trees as nested hashes

CONTENTS

SYNOPSIS



 # (inefficiently) duplicate a file tree from path a to b
 use File::Slurp::Tree;
 my $tree = slurp_tree( "path_a" );
 spew_tree( "path_b" => $tree );



DESCRIPTION

File::Slurp::Tree provides functions for slurping and emitting trees of files and directories.



 # an example of use in a test suite
 use Test::More tests => 1;
 use File::Slurp::Tree;
 is_deeply( slurp_tree( "t/some_path" ), { foo => {}, bar => "sample\n" },
            "some_path contains a directory called foo, and a file bar" );



The tree datastructure is a hash of hashes. The keys of each hash are names of directories or files. Directories have hash references as their value, files have a scalar which holds the contents of the file.

EXPORTED ROUTINES

slurp_tree( CW$path, CW%options )

return a nested hash reference containing everything within $path

%options may include the following keys:
rule a File::Find::Rule object that will match the files and directories in the path. defaults to an empty rule (matches everything)

spew_tree( CW$path => CW$tree )

Creates a file tree as described by $tree at $path

BUGS

None currently known. If you find any please contact the author.

AUTHOR

Richard Clamp <richardc@unixbeard.net>

COPYRIGHT

Copyright (C) 2003, 2006 Richard Clamp. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

File::Slurp, Test::More
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 FILE::SLURP::TREE (3) 2006-07-14

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.