File Coverage

blib/lib/Parse/Functions/Perl.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 20 21 95.2


line stmt bran cond sub pod time code
1             package Parse::Functions::Perl;
2              
3 1     1   21755 use 5.008;
  1         3  
  1         39  
4 1     1   4 use strict;
  1         3  
  1         34  
5 1     1   5 use warnings;
  1         1  
  1         22  
6 1     1   399 use Parse::Functions;
  1         2  
  1         109  
7              
8             our $VERSION = '0.01';
9             our @ISA = qw(Parse::Functions);
10              
11             # TODO: the regex containing func|method should either reuse what
12             # Padre has in PPIx::EditorTools::Outline or copy the list from there
13             # for now let's leave it as it is and focus on improving the Outline
14             # code and then we'll see if we reuse or copy paste.
15              
16             sub function_re {
17 3     3 0 6 my ($self) = @_;
18              
19 3         14 my $newline = $self->newline;
20 3         166 return qr{
21             (?:
22             ${newline}__(?:DATA|END)__\b.*
23             |
24             $newline$newline=\w+.*?$newline\s*?$newline=cut\b(?=.*?(?:$newline){1,2})
25             |
26             (?:^|$newline)\s*
27             (?:
28             (?:sub|func|method|before|after|around|override|augment)\s+(\w+(?:::\w+)*)
29             |
30             \* (\w+(?:::\w+)*) \s*=\s* (?: sub\b | \\\& )
31             )
32             )
33             }sx;
34             }
35              
36             1;
37              
38             # Copyright 2008-2014 The Padre development team as listed in Padre.pm.
39             # LICENSE
40             # This program is free software; you can redistribute it and/or
41             # modify it under the same terms as Perl 5 itself.
42