Re: Pod::Simple::Select

[email protected] (Karl Williamson) Thu, 30 Mar 2017 11:51:33 -0600
Newsgroups perl.pod-people
Message-ID <[email protected]>
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 selec=
t
> method begins
>
> -          Having a $parser ->select({ head1 =3D>[=93Name=94,
> =93this\\s*is\\s*a\\s*title=94 ], head2=3D>{=93foo=94, =93bar=94}   }) =
method, to give
> pod directive to select section of the pod. Here the selected pod
> directives would be
>
> =3Dhead1 Name
>      =85.
> =3Dhead2 Foo
>   =85
> =3Dhead 1 This is a title
>      =85..
> =3Dhead2 bar
>     =85.
>
> -           Having all the entries for a pod directive given in ->selec=
t
> 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 =85 end) for eac=
h
> 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=85 even if one has someth=
ing
> like
>
> =3Dhead2 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=E7ois
>
>
>

I don't know without delving deeper into things.  But I have worked on=20
code to extract just the pod from a file containing other content, and=20
that isn't as simple as it might seem, requiring changes in the heart of=20
Pod::Simple to get it all right.  I shelved this work, but expect to=20
complete it in the next 2 months.

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