A class can be passwed to script
[catagits/CatalystX-HelpText.git] / lib / CatalystX / HelpText / Finder / TemplateToolkit / Regexp.pm
1 package CatalystX::HelpText::Finder::TemplateToolkit::Regexp;
2 use Moose;
3 use Moose::Autobox;
4 use List::MoreUtils qw/ uniq /;
5
6 sub find_helptext_keys_in_fn {
7     my ($self, $fn, $script) = @_;
8     open(FILE, $fn) or warn "Can't open $fn\n" && return;
9     my @keys = ();
10     while (<FILE>) {
11         if (my ($key) = m/help_text\(\s*['"](.*)['"]\s*\)/o) {
12             push @keys, $key;
13         }
14     }
15     close(FILE);
16     return [ uniq @keys ];
17 }
18
19 1;