File::Find::Rule::TTMETA - Find files based on Template Toolkit META directives
use File::Find::Rule qw(:TTMETA); my @files = find(ttmeta => { author => "darren chamberlain" }, in => "/var/www/html");
File::Find::Rule::TTMETA extends File::Find::Rule to work with Template Toolkit templates by providing access to template-specific metadata.
File::Find::Rule::TTMETA
File::Find::Rule
File::Find::Rule::TTMETA adds a ttmeta method / keyword to File::Find::Rule. ttmeta takes a series of name, value tuples, each of which is compared to the metadata for the file in question (a Template::Provider instance attempts to treat each file as a template; compile errors are silently skipped). A file matches if each element of metadata defined in ttmeta is present. If there are multiple keys defined, all must match for the file to be considered a match.
ttmeta
Template::Provider
Values can be strings or regexes:
find(ttmeta => { VERSION => qr/^2\.\d+/ } => in => $dir); File::Find::Rule->file ->ttmeta(color => "green", sheep => 3) ->in($dir);
More complex variables are not (currently) supported by this module, even though Template::Document supports them. Patches welcome.
Template::Document
File::Find::Rule::TTMETA uses Template::Config to instantiate its Template::Provider instance, so it is possible to use custom provider subclasses.
Template::Config
The Template::Provider instance that is created has only ABSOLUTE => 1 set, mainly because most of the other options don't really apply here, but also because I can't think of an elegant way to pass configuration parameters to the constructor.
ABSOLUTE => 1
File::Find::Rule, Template
To install File::Find::Rule::TTMETA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Find::Rule::TTMETA
CPAN shell
perl -MCPAN -e shell install File::Find::Rule::TTMETA
For more information on module installation, please visit the detailed CPAN module installation guide.