Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pod::Simple::Select

1 view
Skip to first unread message

RAPPAZ Francois via pod-people

unread,
Mar 30, 2017, 8:30:03 AM3/30/17
to pod-p...@perl.org

At the end, I got the idea of

-          Subclassing Pod::Simple to detect the start line of pod directive that I want to select and extract from a pod file. The end line is when a cut is met or when another directive  given in the select method begins

-          Having a $parser ->select({ head1 =>[“Name”, “this\\s*is\\s*a\\s*title” ], head2=>{“foo”, “bar”}   }) method, to give pod directive to select section of the pod. Here the selected pod directives would be

=head1 Name
     ….
=head2 Foo
  …
=head 1 This is a title
     …..
=head2 bar
    ….

-           Having all the entries for a pod directive given in ->select and found in the file, stored with the start line and line and the corresponding array ref given in select. That should not eat too much memory.

-          Using Tie::File to extract the line ( start … end) for each pod directive found in the file. Since Tie::File does not load the file into memory,  this should work even for big files.

 

For the few simple test I have made, it works… even if one has something like

=head2 This get C<complicated>

 

Have I reinvented the wheel or is it worth to make a Pode::Simple::Select module with these  ~190 lines of codes ?

Thanks

 

François

 

Karl Williamson

unread,
Mar 30, 2017, 2:30:03 PM3/30/17
to RAPPAZ Francois, pod-p...@perl.org
I don't know without delving deeper into things. But I have worked on
code to extract just the pod from a file containing other content, and
that isn't as simple as it might seem, requiring changes in the heart of
Pod::Simple to get it all right. I shelved this work, but expect to
complete it in the next 2 months.

So your idea may work, but there may be edge cases which it fails in.
0 new messages