[Templates] PATCH Template::Plugin::Directory
Andy Wardley
abw@kfs.org
Tue, 12 Mar 2002 15:03:26 +0000
On Sun, Mar 10, 2002 at 09:46:36PM -0800, Allen Day wrote:
> I've patched the Directory plugin to allow filename filtering.
> Now you can do like so:
>
> [% USE d = Directory(somedir,root=someroot) %]
> [% d.files.size %] # maybe 100 files
> [% d.files('jpe?g$').size %] # but only 90 jpeg images
Nice idea, although for completeness it would be nice if the 'dirs'
and 'list' methods also supported the same option.
And then it occurred to me that we should instead add the 'grep' virtual
list method so that you can do this:
[% d.files.grep('jpe?g') %]
And of course, this works for any other list, too.
Thanks for the patch, anyway.
A