One wouldn't normally create a class per directory. One would normally create a class for directories, and create an instance of the class for each directory.
With Class::Struct, you'd get something like the following:
use Class::Struct File => { name => '$', }; use Class::Struct Directory => { name => '$', children => '@', # An array of File and Directory objects. };
But a structure is rather limiting. For starters, creating an object requires having created an object for each of its children first, meaning the entire directory subtree would need to be read whether its needed or not. In practice, reading the entries of the directory needs be done in demand, like Path::Class::Dir's children does.
In reply to Re: Recursive Class:Struct syntax error?
by ikegami
in thread Recursive Class:Struct syntax error?
by ibm1620
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |