Forums : The Ohcount Project

Dear Open Hub Users,

We’re excited to announce that we will be moving the Open Hub Forum to https://community.synopsys.com/s/black-duck-open-hub. Beginning immediately, users can head over, register, get technical help and discuss issue pertinent to the Open Hub. Registered users can also subscribe to Open Hub announcements here.


On May 1, 2020, we will be freezing https://www.openhub.net/forums and users will not be able to create new discussions. If you have any questions and concerns, please email us at [email protected]

ohcount won't parse whole perl file

Hi,

I was trying ohcount and it seems that it doesn't parse the whole file. A lot of my files have a large POD block at the end. Ohcount parses these blocks only if there is a '=cut' line at the end if the file. If that line is missing it will stop just before the beginning of the POD block.

I hope someone can patch the parser to take this into account.

Peter Stuifzand over 15 years ago
 

Hi Peter,

If you send me a link to a sample file I'll take a look.

Robin Luckey over 15 years ago
 

Hi Robin,

I've created an example file for you: http://peterstuifzand.nl/files/ohcount_testfile.pl. In there are a lot of comments. Almost the whole file. But ohcount says there are zero. When you add a '=cut' line at the end, then ohcount counts the comments.

Peter Stuifzand over 15 years ago
 

Hi Peter,

Thanks for the link.

I can confirm that Ohcount fails to parse this...

=head1 NAME

...but does parse this:

=head1 NAME
=cut

Our parser won't return the comment block until it is closed. Because the perlpod comment started by =head is never explicitly closed, our parser never surfaces the completed comment.

This raises the question, is a =head unclosed by a =cut valid syntax?

I'll come right out and say that we do not at all prioritize trying to parse invalid syntax.

However, I'm no perl expert, and maybe I'm wrong. Is the =cut truly optional?

Our parser might have some trouble with structures that are opened and then only optionally closed. This might take some fiddling to get that working.

Robin Luckey over 15 years ago
 

Thanks for looking into this. I found a POD specification in the Perl documentation: perlpodspec

It mentions the pod blocks continue to =cut or end-of-file. See the line that starts with 'Pod content is contained'.

Peter Stuifzand over 15 years ago
 

Hi Peter,

I've opened a ticket for this bug. Unfortunately I won't have time to work on this anytime this week, but there are some savvy Ohcount folks out there who might pick up on this.

Thanks,
Robin

Robin Luckey over 15 years ago
 

I'll look into it this week when I have time off of school

Anonymous Coward over 15 years ago
 

Peter,

Mitchell has come up with the fix, and I've applied it to the main line. If you want to pull the latest code, you should receive the fix.

If you have some particular projects on Ohloh that you'd like to have recounted, let me know and I'll get them started.

Thanks,
Robin

Robin Luckey over 15 years ago
 

Thanks Mitchell and Robin for your help.

Peter Stuifzand over 15 years ago