[Templates] PATCH Template::Plugin::Directory

Allen Day allenday@ucla.edu
Wed, 13 Mar 2002 11:26:09 -0800 (PST)


> > I plan on adding recursive directory listing to this plugin as well...
> soon.
>
> What syntax do you plan for this?
> Do you want to say in templates: directory.subdir1.subdir2.files?

I hadn't planned anything so complex, but maybe you have a good idea.  We
should talk about our needs so we make something useful for everyone.

I want to be able to count files matching a regex, like:

[% #prints 100 %]
[% dir1 = Directory(path,recurse=1) %]
[% recursed_match = dir1.files | grep('jpe?g') %]
[% recursed_match.size %]

[% #prints 10 %]
[% dir2 = Directory(path) %]
[% match = dir2.files | grep('jpe?g') %]
[% match.size %]

Andy, is grep() available in the new developer release?  Or do I need to
continue using my file() patch?

-Allen