Skip to content

Commit d9dd65c

Browse files
authored
Merge pull request #18 from albert-github/feature/bug_sub_recogn
Recognizing subroutine definitions.
2 parents ed5ca07 + dd73f76 commit d9dd65c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Doxygen/Filter/Perl.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ sub ProcessFile
213213
if ($self->{'_sState'} eq 'NORMAL')
214214
{
215215
$logger->debug("We are in state: NORMAL");
216-
if ($line =~ /^\s*sub\s*(.*)/) { $self->_ChangeState('METHOD'); }
216+
if ($line =~ /^\s*sub\s+([\w]+)/ and $line =~ /^\s*sub\s+([\D][\w]*)/) { $self->_ChangeState('METHOD'); }
217217
elsif ($line =~ /^\s*#\*\*\s*\@/) { $self->_ChangeState('DOXYGEN'); }
218218
elsif ($line =~ /^=.*/) { $self->_ChangeState('POD'); }
219219
}
@@ -240,7 +240,7 @@ sub ProcessFile
240240
{
241241
# If this comment block is right next to a subroutine, lets make sure we
242242
# handle that condition
243-
if ($line =~ /^\s*sub\s*(.*)/) { $self->_ChangeState('METHOD'); }
243+
if ($line =~ /^\s*sub\s+([\w]+)/ and $line =~ /^\s*sub\s+([\D][\w]*)/) { $self->_ChangeState('METHOD'); }
244244
}
245245
}
246246
}
@@ -703,7 +703,7 @@ sub _ProcessPerlMethod
703703

704704
my $sClassName = $self->{'_sCurrentClass'};
705705

706-
if ($line =~ /^\s*sub\s+(.*)/)
706+
if ($line =~ /^\s*sub\s+([\w]+)/ and $line =~ /^\s*sub\s+([\D][\w]*)/)
707707
{
708708
# We should keep track of the order in which the methods were written in the code so we can print
709709
# them out in the same order

0 commit comments

Comments
 (0)