Hi,
I'm looking for a module which would operate similar to the following example.
If anyone has suggestions or feedback, I'd like to hear them. (I'd really
like to here "it's already been solved".)
In the event that it hasn't been solved, suggestions on the name and interface
are just as welcome.
It seems like a fairly generic problem. I'm actually planning on using it as
a component in an image organizational system this week and a cad application
sometime in the near future. Basically, you have some table of values, and
want to make some set of those values into the directory names in a nested
directory tree, possibly using one of them to create the filename at the end.
I've only shown string data in this example, but I've also considered a
filename (which would copy it to said location in the tree.) Probably also a
subroutine ref interface (which would call the referenced subroutine with the
resultant filename as an argument.)
Thanks,
Eric
NAME
File::Path::Populate - Populate a directory hierarchy with data.
SYNOPSIS
my $fpp = File::Path::Populate->new(base => $basedir);
my @header = qw(farmer_name geese chickens ducks);
$fpp->header([EMAIL PROTECTED]);
my @table = (
["dan", 7, 3, 2],
["joe", 0, 5, 2],
);
$fpp->values([EMAIL PROTECTED]);
my @structure = qw(
ducks
geese
chickens
/
farmer_name
.txt
);
$fpp->hierarchy([EMAIL PROTECTED]);
my @data = (
"Mr. Farmer Dan",
"Just call me Joe"
);
$fpp->populate([EMAIL PROTECTED]);
This gives the following tree under $basedir:
.
`-- 2
|-- 0
| `-- 5
| `-- joe.txt
`-- 7
`-- 3
`-- dan.txt
The file 2/0/5/joe.txt would contain the text "Just call me Joe", while
2/7/3/dan.txt reads "Mr. Farmer Dan".
--
"It works better if you plug it in!"
--Sattinger's Law