- AVAILABILITY AND BUG REPORTING
- KNOWN BUGS AND LIMITATIONS
Text::FileTree - convert a list of files with full paths to a tree
A file list can be organized in a number of ways. The two that most probably comes to mind is a "state free" way, where each file is listed with full path and doesn't depend on its context. The
find command outputs files in this way.
There is also the "stateful" way of display file lists, where each file is sorted by its common parents. E.g., instead of
you might have the following structure instead:
foo/ bar baz
This module does just that, converts a "plain" file listing in to the "stateful", directory sorted, way.
my $ft = Text::FileTree->new( ); my $ft_w32 = Text::FileTree->new( platform => 'Win32' );
Create a FileTree parser object. By default, it assume the files are in the platform native format, but this can be overriden. Internally, File::Spec is used, but by specifiying a platform parameter
File::Spec::<platform> is used instead.
Load the file list from a file.
Load the file list from a filehandle (or a filename). Examples:
open(my $pipe, '-|', 'find', '/'); Text::FileTree->new->from_fh($pipe);
Latest released version is available through CPAN. Latest development version is available on github:
We use Github for issue tracking and pull requests.
If you don't have an account on Github (or for other reason don't want to use Github), we are ok with bugs filed on rt.cpan.org as well.
This module does not separate between a file and a directory. This only affects leaf nodes, as you can deduce that a file with children is indeed a directory. This is unlikely to be fixed, as there is really no way of distinguish them in, say, the output from find. Often, you should be able to determine this by context: e.g. by giving
-type f flag --- now all leaf nodes are regular files.
Copyright (c) 2012 - Olof Johansson <email@example.com> All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.