Commit | Line | Data |
54b1774e |
1 | package CatalystX::HelpText::Finder::TemplateToolkit::Regexp; |
2 | use Moose; |
54b1774e |
3 | use List::MoreUtils qw/ uniq /; |
009a8923 |
4 | use namespace::autoclean; |
54b1774e |
5 | |
6 | sub find_helptext_keys_in_fn { |
009a8923 |
7 | my ($self, $fn) = @_; |
8 | open(my $FILE, '<', $fn) or warn "Can't open $fn\n" && return; |
54b1774e |
9 | my @keys = (); |
22c77d41 |
10 | while (my $line = <$FILE>) { |
9a0530a7 |
11 | foreach my $key ($line =~ m/help_text\(\s*['"](\w+)['"]\s*\)/g) { |
54b1774e |
12 | push @keys, $key; |
13 | } |
14 | } |
009a8923 |
15 | close($FILE); |
54b1774e |
16 | return [ uniq @keys ]; |
17 | } |
18 | |
009a8923 |
19 | __PACKAGE__->meta->make_immutable; |
20 | |
21 | 1; |
61d108e4 |
22 | |
23 | |
24 | =head1 NAME |
25 | |
26 | CatalystX::HelpText::Finder::TemplateToolkit::Regexp |
27 | |
28 | =head1 SYNOPSIS |
29 | |
30 | Find helptext keys parsing the templates using a regular expression, it helps to find |
31 | helptext keys which are not called by a simple TT parsing due logical conditions |
32 | |
33 | =head1 SEE ALSO |
34 | |
35 | =over |
36 | |
37 | =item L<CatalystX::HelpText> |
38 | |
39 | =back |
40 | |
41 | =head1 AUTHOR |
42 | |
43 | Toomas Doran, C<< t0m at state51.co.uk >> |
44 | |
45 | Cinxgler Mariaca Minda, C<< cinxgler at ci-info.com >> |
46 | |
47 | =head1 COPYRIGHT |
48 | |
49 | Copyright Oscar Music and Media 2011. |
50 | |
51 | =head1 LICENSE |
52 | |
53 | This sofware is free software, and is licensed under the same terms as perl itself. |
54 | |
55 | =cut |
56 | |