On 03/30/2017 06:17 AM, RAPPAZ Francois via pod-people wrote:
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
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.
