in reply to Parse POD of a method from perl module

Parsing POD is pretty straight forward, cause the format is simple.

The real complication is parsing the corresponding Perl sub names.

like

Could you please give us more informations about what you are trying to achieve?

Unfortunately solutions in Perl are not very DRY (thats why I envy Python for stealing docstrings from Lisp)

For instance one of my last employers used a POD server which automatically parsed all installed modules to create CPAN like web-pages including TOCs listing each function/method.

Following the links you got the POD for each sub and the code was JS-folded in between.

Thats what you want? For instance this solution would imply switching from head1 to head2 in your POD.

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re: Parse POD of a method from perl module

Replies are listed 'Best First'.
Re^2: Parse POD of a method from perl module
by perlUser9 (Novice) on May 13, 2014 at 22:36 UTC
    Hi Rolf, Thanks for your reply. I need to retrieve the POD for a specific method and want to provide that to RIDE (IDE for Robot framework I am using). I need to show the POD as a description/information about the method in RIDE. I saw couple of Perl modules like Pod::Simple, Pod::Parser but they work on the whole module. And my requirement is for the method.
      i.o.W. your input are
      • name of the head1
      • path of a module
      and you just want the POD-content, no source code?

      As mentioned ready-to-use solutions expect you to follow certain conventions!

      But a simple perl-script to parse everything between =head1 NAME and =cut is straight forwardly implemented with a flip-flop range and easily adapted if your format has variations (different conventions¹)

      Cheers Rolf

      ( addicted to the Perl Programming Language)

      ¹) e.g are you aware that your example is "invalid" POD b/c of missing empty lines?

        Hi Rolf, I don't need the source code. Yes looks like it's better to write some code to parse my modules and retrieve everything between =head1 and =cut as per the method name. Thanks a ton for the help.