use Template;
use namespace::autoclean;
+has template_search_dir => (
+ isa => Str,
+ is => 'ro',
+ required => 1,
+);
+
sub find_helptext_keys_in_fn {
- my ($self, $fn, $script) = @_;
+ my ($self, $fn) = @_;
my @keys = ();
my $t = Template->new({
- INCLUDE_PATH => [ $script->template_search_dir ],
+ INCLUDE_PATH => [ $self->template_search_dir ],
ABSOLUTE => 1,
});
my $out;
isa => LoadableClass,
coerce => 1,
default => 'CatalystX::HelpText::Finder::TemplateToolkit',
+ handles => "_construct_finder",
+);
+
+has finder => (
+ isa => duck_type([qw/ find_helptext_keys_in_fn /]),
+ default => sub {
+ my $self = shift;
+ $self->_construct_finder( # Args here
+ );
+ },
+ lazy => 1,
handles => {
- find_helptext_keys_in_fn => 'find_helptext_keys_in_fn',
+ _find_helptext_keys_in_fn => 'find_helptext_keys_in_fn',
}
);
return [ @files ];
}
-sub _find_helptext_keys_in_fn {
- my ($self, $fn) = @_;
- return $self->find_helptext_keys_in_fn($fn, $self);
-}
-
sub _helptext_file_for_key_exists {
my ($self, $key) = @_;
my $file = $self->_get_file($key);