Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

851 lines
21 KiB

  1. #############################################################################
  2. # Pod/ParseUtils.pm -- helpers for POD parsing and conversion
  3. #
  4. # Copyright (C) 1999-2000 by Marek Rouchal. All rights reserved.
  5. # This file is part of "PodParser". PodParser is free software;
  6. # you can redistribute it and/or modify it under the same terms
  7. # as Perl itself.
  8. #############################################################################
  9. package Pod::ParseUtils;
  10. use vars qw($VERSION);
  11. $VERSION = 0.22; ## Current version of this package
  12. require 5.005; ## requires this Perl version or later
  13. =head1 NAME
  14. Pod::ParseUtils - helpers for POD parsing and conversion
  15. =head1 SYNOPSIS
  16. use Pod::ParseUtils;
  17. my $list = new Pod::List;
  18. my $link = Pod::Hyperlink->new('Pod::Parser');
  19. =head1 DESCRIPTION
  20. B<Pod::ParseUtils> contains a few object-oriented helper packages for
  21. POD parsing and processing (i.e. in POD formatters and translators).
  22. =cut
  23. #-----------------------------------------------------------------------------
  24. # Pod::List
  25. #
  26. # class to hold POD list info (=over, =item, =back)
  27. #-----------------------------------------------------------------------------
  28. package Pod::List;
  29. use Carp;
  30. =head2 Pod::List
  31. B<Pod::List> can be used to hold information about POD lists
  32. (written as =over ... =item ... =back) for further processing.
  33. The following methods are available:
  34. =over 4
  35. =item Pod::List-E<gt>new()
  36. Create a new list object. Properties may be specified through a hash
  37. reference like this:
  38. my $list = Pod::List->new({ -start => $., -indent => 4 });
  39. See the individual methods/properties for details.
  40. =cut
  41. sub new {
  42. my $this = shift;
  43. my $class = ref($this) || $this;
  44. my %params = @_;
  45. my $self = {%params};
  46. bless $self, $class;
  47. $self->initialize();
  48. return $self;
  49. }
  50. sub initialize {
  51. my $self = shift;
  52. $self->{-file} ||= 'unknown';
  53. $self->{-start} ||= 'unknown';
  54. $self->{-indent} ||= 4; # perlpod: "should be the default"
  55. $self->{_items} = [];
  56. $self->{-type} ||= '';
  57. }
  58. =item $list-E<gt>file()
  59. Without argument, retrieves the file name the list is in. This must
  60. have been set before by either specifying B<-file> in the B<new()>
  61. method or by calling the B<file()> method with a scalar argument.
  62. =cut
  63. # The POD file name the list appears in
  64. sub file {
  65. return (@_ > 1) ? ($_[0]->{-file} = $_[1]) : $_[0]->{-file};
  66. }
  67. =item $list-E<gt>start()
  68. Without argument, retrieves the line number where the list started.
  69. This must have been set before by either specifying B<-start> in the
  70. B<new()> method or by calling the B<start()> method with a scalar
  71. argument.
  72. =cut
  73. # The line in the file the node appears
  74. sub start {
  75. return (@_ > 1) ? ($_[0]->{-start} = $_[1]) : $_[0]->{-start};
  76. }
  77. =item $list-E<gt>indent()
  78. Without argument, retrieves the indent level of the list as specified
  79. in C<=over n>. This must have been set before by either specifying
  80. B<-indent> in the B<new()> method or by calling the B<indent()> method
  81. with a scalar argument.
  82. =cut
  83. # indent level
  84. sub indent {
  85. return (@_ > 1) ? ($_[0]->{-indent} = $_[1]) : $_[0]->{-indent};
  86. }
  87. =item $list-E<gt>type()
  88. Without argument, retrieves the list type, which can be an arbitrary value,
  89. e.g. C<OL>, C<UL>, ... when thinking the HTML way.
  90. This must have been set before by either specifying
  91. B<-type> in the B<new()> method or by calling the B<type()> method
  92. with a scalar argument.
  93. =cut
  94. # The type of the list (UL, OL, ...)
  95. sub type {
  96. return (@_ > 1) ? ($_[0]->{-type} = $_[1]) : $_[0]->{-type};
  97. }
  98. =item $list-E<gt>rx()
  99. Without argument, retrieves a regular expression for simplifying the
  100. individual item strings once the list type has been determined. Usage:
  101. E.g. when converting to HTML, one might strip the leading number in
  102. an ordered list as C<E<lt>OLE<gt>> already prints numbers itself.
  103. This must have been set before by either specifying
  104. B<-rx> in the B<new()> method or by calling the B<rx()> method
  105. with a scalar argument.
  106. =cut
  107. # The regular expression to simplify the items
  108. sub rx {
  109. return (@_ > 1) ? ($_[0]->{-rx} = $_[1]) : $_[0]->{-rx};
  110. }
  111. =item $list-E<gt>item()
  112. Without argument, retrieves the array of the items in this list.
  113. The items may be represented by any scalar.
  114. If an argument has been given, it is pushed on the list of items.
  115. =cut
  116. # The individual =items of this list
  117. sub item {
  118. my ($self,$item) = @_;
  119. if(defined $item) {
  120. push(@{$self->{_items}}, $item);
  121. return $item;
  122. }
  123. else {
  124. return @{$self->{_items}};
  125. }
  126. }
  127. =item $list-E<gt>parent()
  128. Without argument, retrieves information about the parent holding this
  129. list, which is represented as an arbitrary scalar.
  130. This must have been set before by either specifying
  131. B<-parent> in the B<new()> method or by calling the B<parent()> method
  132. with a scalar argument.
  133. =cut
  134. # possibility for parsers/translators to store information about the
  135. # lists's parent object
  136. sub parent {
  137. return (@_ > 1) ? ($_[0]->{-parent} = $_[1]) : $_[0]->{-parent};
  138. }
  139. =item $list-E<gt>tag()
  140. Without argument, retrieves information about the list tag, which can be
  141. any scalar.
  142. This must have been set before by either specifying
  143. B<-tag> in the B<new()> method or by calling the B<tag()> method
  144. with a scalar argument.
  145. =back
  146. =cut
  147. # possibility for parsers/translators to store information about the
  148. # list's object
  149. sub tag {
  150. return (@_ > 1) ? ($_[0]->{-tag} = $_[1]) : $_[0]->{-tag};
  151. }
  152. #-----------------------------------------------------------------------------
  153. # Pod::Hyperlink
  154. #
  155. # class to manipulate POD hyperlinks (L<>)
  156. #-----------------------------------------------------------------------------
  157. package Pod::Hyperlink;
  158. =head2 Pod::Hyperlink
  159. B<Pod::Hyperlink> is a class for manipulation of POD hyperlinks. Usage:
  160. my $link = Pod::Hyperlink->new('alternative text|page/"section in page"');
  161. The B<Pod::Hyperlink> class is mainly designed to parse the contents of the
  162. C<LE<lt>...E<gt>> sequence, providing a simple interface for accessing the
  163. different parts of a POD hyperlink for further processing. It can also be
  164. used to construct hyperlinks.
  165. =over 4
  166. =item Pod::Hyperlink-E<gt>new()
  167. The B<new()> method can either be passed a set of key/value pairs or a single
  168. scalar value, namely the contents of a C<LE<lt>...E<gt>> sequence. An object
  169. of the class C<Pod::Hyperlink> is returned. The value C<undef> indicates a
  170. failure, the error message is stored in C<$@>.
  171. =cut
  172. use Carp;
  173. sub new {
  174. my $this = shift;
  175. my $class = ref($this) || $this;
  176. my $self = +{};
  177. bless $self, $class;
  178. $self->initialize();
  179. if(defined $_[0]) {
  180. if(ref($_[0])) {
  181. # called with a list of parameters
  182. %$self = %{$_[0]};
  183. $self->_construct_text();
  184. }
  185. else {
  186. # called with L<> contents
  187. return undef unless($self->parse($_[0]));
  188. }
  189. }
  190. return $self;
  191. }
  192. sub initialize {
  193. my $self = shift;
  194. $self->{-line} ||= 'undef';
  195. $self->{-file} ||= 'undef';
  196. $self->{-page} ||= '';
  197. $self->{-node} ||= '';
  198. $self->{-alttext} ||= '';
  199. $self->{-type} ||= 'undef';
  200. $self->{_warnings} = [];
  201. }
  202. =item $link-E<gt>parse($string)
  203. This method can be used to (re)parse a (new) hyperlink, i.e. the contents
  204. of a C<LE<lt>...E<gt>> sequence. The result is stored in the current object.
  205. Warnings are stored in the B<warnings> property.
  206. E.g. sections like C<LE<lt>open(2)E<gt>> are deprected, as they do not point
  207. to Perl documents. C<LE<lt>DBI::foo(3p)E<gt>> is wrong as well, the manpage
  208. section can simply be dropped.
  209. =cut
  210. sub parse {
  211. my $self = shift;
  212. local($_) = $_[0];
  213. # syntax check the link and extract destination
  214. my ($alttext,$page,$node,$type) = (undef,'','','');
  215. $self->{_warnings} = [];
  216. # collapse newlines with whitespace
  217. s/\s*\n+\s*/ /g;
  218. # strip leading/trailing whitespace
  219. if(s/^[\s\n]+//) {
  220. $self->warning("ignoring leading whitespace in link");
  221. }
  222. if(s/[\s\n]+$//) {
  223. $self->warning("ignoring trailing whitespace in link");
  224. }
  225. unless(length($_)) {
  226. _invalid_link("empty link");
  227. return undef;
  228. }
  229. ## Check for different possibilities. This is tedious and error-prone
  230. # we match all possibilities (alttext, page, section/item)
  231. #warn "DEBUG: link=$_\n";
  232. # only page
  233. # problem: a lot of people use (), or (1) or the like to indicate
  234. # man page sections. But this collides with L<func()> that is supposed
  235. # to point to an internal funtion...
  236. my $page_rx = '[\w.]+(?:::[\w.]+)*(?:[(](?:\d\w*|)[)]|)';
  237. # page name only
  238. if(m!^($page_rx)$!o) {
  239. $page = $1;
  240. $type = 'page';
  241. }
  242. # alttext, page and "section"
  243. elsif(m!^(.*?)\s*[|]\s*($page_rx)\s*/\s*"(.+)"$!o) {
  244. ($alttext, $page, $node) = ($1, $2, $3);
  245. $type = 'section';
  246. }
  247. # alttext and page
  248. elsif(m!^(.*?)\s*[|]\s*($page_rx)$!o) {
  249. ($alttext, $page) = ($1, $2);
  250. $type = 'page';
  251. }
  252. # alttext and "section"
  253. elsif(m!^(.*?)\s*[|]\s*(?:/\s*|)"(.+)"$!) {
  254. ($alttext, $node) = ($1,$2);
  255. $type = 'section';
  256. }
  257. # page and "section"
  258. elsif(m!^($page_rx)\s*/\s*"(.+)"$!o) {
  259. ($page, $node) = ($1, $2);
  260. $type = 'section';
  261. }
  262. # page and item
  263. elsif(m!^($page_rx)\s*/\s*(.+)$!o) {
  264. ($page, $node) = ($1, $2);
  265. $type = 'item';
  266. }
  267. # only "section"
  268. elsif(m!^/?"(.+)"$!) {
  269. $node = $1;
  270. $type = 'section';
  271. }
  272. # only item
  273. elsif(m!^\s*/(.+)$!) {
  274. $node = $1;
  275. $type = 'item';
  276. }
  277. # non-standard: Hyperlink
  278. elsif(m!^((?:http|ftp|mailto|news):.+)$!i) {
  279. $node = $1;
  280. $type = 'hyperlink';
  281. }
  282. # alttext, page and item
  283. elsif(m!^(.*?)\s*[|]\s*($page_rx)\s*/\s*(.+)$!o) {
  284. ($alttext, $page, $node) = ($1, $2, $3);
  285. $type = 'item';
  286. }
  287. # alttext and item
  288. elsif(m!^(.*?)\s*[|]\s*/(.+)$!) {
  289. ($alttext, $node) = ($1,$2);
  290. }
  291. # nonstandard: alttext and hyperlink
  292. elsif(m!^(.*?)\s*[|]\s*((?:http|ftp|mailto|news):.+)$!) {
  293. ($alttext, $node) = ($1,$2);
  294. $type = 'hyperlink';
  295. }
  296. # must be an item or a "malformed" section (without "")
  297. else {
  298. $node = $_;
  299. $type = 'item';
  300. }
  301. # collapse whitespace in nodes
  302. $node =~ s/\s+/ /gs;
  303. # empty alternative text expands to node name
  304. if(defined $alttext) {
  305. if(!length($alttext)) {
  306. $alttext = $node | $page;
  307. }
  308. }
  309. else {
  310. $alttext = '';
  311. }
  312. if($page =~ /[(]\w*[)]$/) {
  313. $self->warning("(section) in '$page' deprecated");
  314. }
  315. if($node =~ m:[|/]:) {
  316. $self->warning("node '$node' contains non-escaped | or /");
  317. }
  318. if($alttext =~ m:[|/]:) {
  319. $self->warning("alternative text '$node' contains non-escaped | or /");
  320. }
  321. $self->{-page} = $page;
  322. $self->{-node} = $node;
  323. $self->{-alttext} = $alttext;
  324. #warn "DEBUG: page=$page section=$section item=$item alttext=$alttext\n";
  325. $self->{-type} = $type;
  326. $self->_construct_text();
  327. 1;
  328. }
  329. sub _construct_text {
  330. my $self = shift;
  331. my $alttext = $self->alttext();
  332. my $type = $self->type();
  333. my $section = $self->node();
  334. my $page = $self->page();
  335. my $page_ext = '';
  336. $page =~ s/([(]\w*[)])$// && ($page_ext = $1);
  337. if($alttext) {
  338. $self->{_text} = $alttext;
  339. }
  340. elsif($type eq 'hyperlink') {
  341. $self->{_text} = $section;
  342. }
  343. else {
  344. $self->{_text} = (!$section ? '' :
  345. $type eq 'item' ? "the $section entry" :
  346. "the section on $section" ) .
  347. ($page ? ($section ? ' in ':'') . "the $page$page_ext manpage" :
  348. ' elsewhere in this document');
  349. }
  350. # for being marked up later
  351. # use the non-standard markers P<> and Q<>, so that the resulting
  352. # text can be parsed by the translators. It's their job to put
  353. # the correct hypertext around the linktext
  354. if($alttext) {
  355. $self->{_markup} = "Q<$alttext>";
  356. }
  357. elsif($type eq 'hyperlink') {
  358. $self->{_markup} = "Q<$section>";
  359. }
  360. else {
  361. $self->{_markup} = (!$section ? '' :
  362. $type eq 'item' ? "the Q<$section> entry" :
  363. "the section on Q<$section>" ) .
  364. ($page ? ($section ? ' in ':'') . "the P<$page>$page_ext manpage" :
  365. ' elsewhere in this document');
  366. }
  367. }
  368. =item $link-E<gt>markup($string)
  369. Set/retrieve the textual value of the link. This string contains special
  370. markers C<PE<lt>E<gt>> and C<QE<lt>E<gt>> that should be expanded by the
  371. translator's interior sequence expansion engine to the
  372. formatter-specific code to highlight/activate the hyperlink. The details
  373. have to be implemented in the translator.
  374. =cut
  375. #' retrieve/set markuped text
  376. sub markup {
  377. return (@_ > 1) ? ($_[0]->{_markup} = $_[1]) : $_[0]->{_markup};
  378. }
  379. =item $link-E<gt>text()
  380. This method returns the textual representation of the hyperlink as above,
  381. but without markers (read only). Depending on the link type this is one of
  382. the following alternatives (the + and * denote the portions of the text
  383. that are marked up):
  384. the +perl+ manpage
  385. the *$|* entry in the +perlvar+ manpage
  386. the section on *OPTIONS* in the +perldoc+ manpage
  387. the section on *DESCRIPTION* elsewhere in this document
  388. =cut
  389. # The complete link's text
  390. sub text {
  391. $_[0]->{_text};
  392. }
  393. =item $link-E<gt>warning()
  394. After parsing, this method returns any warnings encountered during the
  395. parsing process.
  396. =cut
  397. # Set/retrieve warnings
  398. sub warning {
  399. my $self = shift;
  400. if(@_) {
  401. push(@{$self->{_warnings}}, @_);
  402. return @_;
  403. }
  404. return @{$self->{_warnings}};
  405. }
  406. =item $link-E<gt>file()
  407. =item $link-E<gt>line()
  408. Just simple slots for storing information about the line and the file
  409. the link was encountered in. Has to be filled in manually.
  410. =cut
  411. # The line in the file the link appears
  412. sub line {
  413. return (@_ > 1) ? ($_[0]->{-line} = $_[1]) : $_[0]->{-line};
  414. }
  415. # The POD file name the link appears in
  416. sub file {
  417. return (@_ > 1) ? ($_[0]->{-file} = $_[1]) : $_[0]->{-file};
  418. }
  419. =item $link-E<gt>page()
  420. This method sets or returns the POD page this link points to.
  421. =cut
  422. # The POD page the link appears on
  423. sub page {
  424. if (@_ > 1) {
  425. $_[0]->{-page} = $_[1];
  426. $_[0]->_construct_text();
  427. }
  428. $_[0]->{-page};
  429. }
  430. =item $link-E<gt>node()
  431. As above, but the destination node text of the link.
  432. =cut
  433. # The link destination
  434. sub node {
  435. if (@_ > 1) {
  436. $_[0]->{-node} = $_[1];
  437. $_[0]->_construct_text();
  438. }
  439. $_[0]->{-node};
  440. }
  441. =item $link-E<gt>alttext()
  442. Sets or returns an alternative text specified in the link.
  443. =cut
  444. # Potential alternative text
  445. sub alttext {
  446. if (@_ > 1) {
  447. $_[0]->{-alttext} = $_[1];
  448. $_[0]->_construct_text();
  449. }
  450. $_[0]->{-alttext};
  451. }
  452. =item $link-E<gt>type()
  453. The node type, either C<section> or C<item>. As an unofficial type,
  454. there is also C<hyperlink>, derived from e.g. C<LE<lt>http://perl.comE<gt>>
  455. =cut
  456. # The type: item or headn
  457. sub type {
  458. return (@_ > 1) ? ($_[0]->{-type} = $_[1]) : $_[0]->{-type};
  459. }
  460. =item $link-E<gt>link()
  461. Returns the link as contents of C<LE<lt>E<gt>>. Reciprocal to B<parse()>.
  462. =back
  463. =cut
  464. # The link itself
  465. sub link {
  466. my $self = shift;
  467. my $link = $self->page() || '';
  468. if($self->node()) {
  469. my $node = $self->node();
  470. $text =~ s/\|/E<verbar>/g;
  471. $text =~ s:/:E<sol>:g;
  472. if($self->type() eq 'section') {
  473. $link .= ($link ? '/' : '') . '"' . $node . '"';
  474. }
  475. elsif($self->type() eq 'hyperlink') {
  476. $link = $self->node();
  477. }
  478. else { # item
  479. $link .= '/' . $node;
  480. }
  481. }
  482. if($self->alttext()) {
  483. my $text = $self->alttext();
  484. $text =~ s/\|/E<verbar>/g;
  485. $text =~ s:/:E<sol>:g;
  486. $link = "$text|$link";
  487. }
  488. $link;
  489. }
  490. sub _invalid_link {
  491. my ($msg) = @_;
  492. # this sets @_
  493. #eval { die "$msg\n" };
  494. #chomp $@;
  495. $@ = $msg; # this seems to work, too!
  496. undef;
  497. }
  498. #-----------------------------------------------------------------------------
  499. # Pod::Cache
  500. #
  501. # class to hold POD page details
  502. #-----------------------------------------------------------------------------
  503. package Pod::Cache;
  504. =head2 Pod::Cache
  505. B<Pod::Cache> holds information about a set of POD documents,
  506. especially the nodes for hyperlinks.
  507. The following methods are available:
  508. =over 4
  509. =item Pod::Cache-E<gt>new()
  510. Create a new cache object. This object can hold an arbitrary number of
  511. POD documents of class Pod::Cache::Item.
  512. =cut
  513. sub new {
  514. my $this = shift;
  515. my $class = ref($this) || $this;
  516. my $self = [];
  517. bless $self, $class;
  518. return $self;
  519. }
  520. =item $cache-E<gt>item()
  521. Add a new item to the cache. Without arguments, this method returns a
  522. list of all cache elements.
  523. =cut
  524. sub item {
  525. my ($self,%param) = @_;
  526. if(%param) {
  527. my $item = Pod::Cache::Item->new(%param);
  528. push(@$self, $item);
  529. return $item;
  530. }
  531. else {
  532. return @{$self};
  533. }
  534. }
  535. =item $cache-E<gt>find_page($name)
  536. Look for a POD document named C<$name> in the cache. Returns the
  537. reference to the corresponding Pod::Cache::Item object or undef if
  538. not found.
  539. =back
  540. =cut
  541. sub find_page {
  542. my ($self,$page) = @_;
  543. foreach(@$self) {
  544. if($_->page() eq $page) {
  545. return $_;
  546. }
  547. }
  548. undef;
  549. }
  550. package Pod::Cache::Item;
  551. =head2 Pod::Cache::Item
  552. B<Pod::Cache::Item> holds information about individual POD documents,
  553. that can be grouped in a Pod::Cache object.
  554. It is intended to hold information about the hyperlink nodes of POD
  555. documents.
  556. The following methods are available:
  557. =over 4
  558. =item Pod::Cache::Item-E<gt>new()
  559. Create a new object.
  560. =cut
  561. sub new {
  562. my $this = shift;
  563. my $class = ref($this) || $this;
  564. my %params = @_;
  565. my $self = {%params};
  566. bless $self, $class;
  567. $self->initialize();
  568. return $self;
  569. }
  570. sub initialize {
  571. my $self = shift;
  572. $self->{-nodes} = [] unless(defined $self->{-nodes});
  573. }
  574. =item $cacheitem-E<gt>page()
  575. Set/retrieve the POD document name (e.g. "Pod::Parser").
  576. =cut
  577. # The POD page
  578. sub page {
  579. return (@_ > 1) ? ($_[0]->{-page} = $_[1]) : $_[0]->{-page};
  580. }
  581. =item $cacheitem-E<gt>description()
  582. Set/retrieve the POD short description as found in the C<=head1 NAME>
  583. section.
  584. =cut
  585. # The POD description, taken out of NAME if present
  586. sub description {
  587. return (@_ > 1) ? ($_[0]->{-description} = $_[1]) : $_[0]->{-description};
  588. }
  589. =item $cacheitem-E<gt>path()
  590. Set/retrieve the POD file storage path.
  591. =cut
  592. # The file path
  593. sub path {
  594. return (@_ > 1) ? ($_[0]->{-path} = $_[1]) : $_[0]->{-path};
  595. }
  596. =item $cacheitem-E<gt>file()
  597. Set/retrieve the POD file name.
  598. =cut
  599. # The POD file name
  600. sub file {
  601. return (@_ > 1) ? ($_[0]->{-file} = $_[1]) : $_[0]->{-file};
  602. }
  603. =item $cacheitem-E<gt>nodes()
  604. Add a node (or a list of nodes) to the document's node list. Note that
  605. the order is kept, i.e. start with the first node and end with the last.
  606. If no argument is given, the current list of nodes is returned in the
  607. same order the nodes have been added.
  608. A node can be any scalar, but usually is a pair of node string and
  609. unique id for the C<find_node> method to work correctly.
  610. =cut
  611. # The POD nodes
  612. sub nodes {
  613. my ($self,@nodes) = @_;
  614. if(@nodes) {
  615. push(@{$self->{-nodes}}, @nodes);
  616. return @nodes;
  617. }
  618. else {
  619. return @{$self->{-nodes}};
  620. }
  621. }
  622. =item $cacheitem-E<gt>find_node($name)
  623. Look for a node or index entry named C<$name> in the object.
  624. Returns the unique id of the node (i.e. the second element of the array
  625. stored in the node arry) or undef if not found.
  626. =cut
  627. sub find_node {
  628. my ($self,$node) = @_;
  629. my @search;
  630. push(@search, @{$self->{-nodes}}) if($self->{-nodes});
  631. push(@search, @{$self->{-idx}}) if($self->{-idx});
  632. foreach(@search) {
  633. if($_->[0] eq $node) {
  634. return $_->[1]; # id
  635. }
  636. }
  637. undef;
  638. }
  639. =item $cacheitem-E<gt>idx()
  640. Add an index entry (or a list of them) to the document's index list. Note that
  641. the order is kept, i.e. start with the first node and end with the last.
  642. If no argument is given, the current list of index entries is returned in the
  643. same order the entries have been added.
  644. An index entry can be any scalar, but usually is a pair of string and
  645. unique id.
  646. =back
  647. =cut
  648. # The POD index entries
  649. sub idx {
  650. my ($self,@idx) = @_;
  651. if(@idx) {
  652. push(@{$self->{-idx}}, @idx);
  653. return @idx;
  654. }
  655. else {
  656. return @{$self->{-idx}};
  657. }
  658. }
  659. =head1 AUTHOR
  660. Marek Rouchal E<lt>marek@saftsack.fs.uni-bayreuth.deE<gt>, borrowing
  661. a lot of things from L<pod2man> and L<pod2roff> as well as other POD
  662. processing tools by Tom Christiansen, Brad Appleton and Russ Allbery.
  663. =head1 SEE ALSO
  664. L<pod2man>, L<pod2roff>, L<Pod::Parser>, L<Pod::Checker>,
  665. L<pod2html>
  666. =cut
  667. 1;