Pod::Simple::Select
[email protected] (RAPPAZ Francois via pod-people) Thu, 30 Mar 2017 12:17:54 +0000
| Newsgroups | perl.pod-people |
|---|---|
| Message-ID | <[email protected]> |
--_000_cee115ef67e544719667ac589e41083csvwexmb4unifrch_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
At the end, I got the idea of
- Subclassing Pod::Simple to detect the start line of pod directiv=
e 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 =3D>["Name", "this\\s*is\\s*a\=
\s*title" ], head2=3D>{"foo", "bar"} }) method, to give pod directive to =
select section of the pod. Here the selected pod directives would be
=3Dhead1 Name
....
=3Dhead2 Foo
...
=3Dhead 1 This is a title
.....
=3Dhead2 bar
....
- Having all the entries for a pod directive given in ->select an=
d found in the file, stored with the start line and line and the correspond=
ing array ref given in select. That should not eat too much memory.
- Using Tie::File to extract the line ( start ... end) for each po=
d 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
=3Dhead2 This get C<complicated>
Have I reinvented the wheel or is it worth to make a Pode::Simple::Select m=
odule with these ~190 lines of codes ?
Thanks
Fran=E7ois
--_000_cee115ef67e544719667ac589e41083csvwexmb4unifrch_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:294064863;
mso-list-type:hybrid;
mso-list-template-ids:1622572262 -259202810 269221891 269221893 269221889 =
269221891 269221893 269221889 269221891 269221893;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"FR-CH" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span lang=3D"EN-GB">At the end, I got the idea of<o=
:p></o:p></span></p>
<p class=3D"MsoListParagraph" style=3D"text-indent:-18.0pt;mso-list:l0 leve=
l1 lfo1"><![if !supportLists]><span lang=3D"EN-GB"><span style=3D"mso-list:=
Ignore">-<span style=3D"font:7.0pt "Times New Roman"">  =
;
</span></span></span><![endif]><span lang=3D"EN-GB">Subclassing Pod::Simple=
to detect the start line of pod directive that I want to select and extrac=
t from a pod file. The end line is when a cut is met or when another direct=
ive given in the select method begins<o:p></o:p></span></p>
<p class=3D"MsoListParagraph" style=3D"text-indent:-18.0pt;mso-list:l0 leve=
l1 lfo1"><![if !supportLists]><span lang=3D"EN-GB"><span style=3D"mso-list:=
Ignore">-<span style=3D"font:7.0pt "Times New Roman"">  =
;
</span></span></span><![endif]><span lang=3D"EN-GB">Having a $parser ->s=
elect({ head1 =3D>[“Name”, “this\\s*is\\s*a\\s*title&#=
8221; ], head2=3D>{“foo”, “bar”} }) =
method, to give pod directive to select section of the pod. Here the select=
ed pod directives would be<br>
<br>
=3Dhead1 Name<br>
….<br>
=3Dhead2 Foo<br>
…<br>
=3Dhead 1 This is a title<br>
…..<br>
=3Dhead2 bar<br>
….<br>
<br>
<o:p></o:p></span></p>
<p class=3D"MsoListParagraph" style=3D"text-indent:-18.0pt;mso-list:l0 leve=
l1 lfo1"><![if !supportLists]><span lang=3D"EN-GB"><span style=3D"mso-list:=
Ignore">-<span style=3D"font:7.0pt "Times New Roman"">  =
;
</span></span></span><![endif]><span lang=3D"EN-GB"> Having all the en=
tries for a pod directive given in ->select and found in the file, store=
d with the start line and line and the corresponding array ref given in sel=
ect. That should not eat too much memory.
<o:p></o:p></span></p>
<p class=3D"MsoListParagraph" style=3D"text-indent:-18.0pt;mso-list:l0 leve=
l1 lfo1"><![if !supportLists]><span lang=3D"EN-GB"><span style=3D"mso-list:=
Ignore">-<span style=3D"font:7.0pt "Times New Roman"">  =
;
</span></span></span><![endif]><span lang=3D"EN-GB">Using Tie::File to extr=
act 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.
<o:p></o:p></span></p>
<p class=3D"MsoListParagraph"><span lang=3D"EN-GB"><o:p> </o:p></span>=
</p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">For the few simple test I have =
made, it works… even if one has something like<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">=3Dhead2 This get C<complica=
ted><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><o:p> </o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">Have I reinvented the wheel or =
is it worth to make a Pode::Simple::Select module with these ~190 lin=
es of codes ?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">Thanks<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><o:p> </o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">Fran=E7ois </span><o:p></o:p></=
p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>
--_000_cee115ef67e544719667ac589e41083csvwexmb4unifrch_--