Expand tests, showing regex finder is broken
[catagits/CatalystX-HelpText.git] / lib / CatalystX / HelpText / Finder / TemplateToolkit.pm
CommitLineData
54b1774e 1package CatalystX::HelpText::Finder::TemplateToolkit;
2use Moose;
54b1774e 3use List::MoreUtils qw/ uniq /;
e5459d76 4use MooseX::Types::Moose qw/Str/;
54b1774e 5use Template;
009a8923 6use namespace::autoclean;
54b1774e 7
16a04c5b 8has template_search_dir => (
9 isa => Str,
10 is => 'ro',
11 required => 1,
12);
13
54b1774e 14sub find_helptext_keys_in_fn {
16a04c5b 15 my ($self, $fn) = @_;
54b1774e 16 my @keys = ();
17 my $t = Template->new({
16a04c5b 18 INCLUDE_PATH => [ $self->template_search_dir ],
54b1774e 19 ABSOLUTE => 1,
20 });
21 my $out;
22 $t->process($fn, { help_text => sub { push @keys, shift } }, \$out);
23 return [ uniq @keys ];
24}
25
009a8923 26__PACKAGE__->meta->make_immutable;
271;
28