Skip to content

Commit 59073ff

Browse files
committed
Recognizing subroutine definitions.
To prevent the recognition of e.g. `sub` in: ``` my %SenderArgs = ( sendmail => [], smtp => [], sub => [], ); ``` as start of a subroutine (and giving in doxygen the warning: ``` warning: member with no name found. ``` the recognition of subroutines has been adjusted.
1 parent b470a10 commit 59073ff

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+([a-zA-Z_].*)/) { $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+([a-zA-Z_].*)/) { $self->_ChangeState('METHOD'); }
244244
}
245245
}
246246
}
@@ -672,7 +672,7 @@ sub _ProcessPerlMethod
672672

673673
my $sClassName = $self->{'_sCurrentClass'};
674674

675-
if ($line =~ /^\s*sub\s+(.*)/)
675+
if ($line =~ /^\s*sub\s+([a-zA-Z_].*)/)
676676
{
677677
# We should keep track of the order in which the methods were written in the code so we can print
678678
# them out in the same order

0 commit comments

Comments
 (0)