1N/A#############################################################################
1N/A# Pod/Checker.pm -- check pod documents for syntax errors
1N/A#
1N/A# Copyright (C) 1994-2000 by Bradford Appleton. All rights reserved.
1N/A# This file is part of "PodParser". PodParser is free software;
1N/A# you can redistribute it and/or modify it under the same terms
1N/A# as Perl itself.
1N/A#############################################################################
1N/A
1N/Apackage Pod::Checker;
1N/A
1N/Ause vars qw($VERSION);
1N/A$VERSION = 1.41; ## Current version of this package
1N/Arequire 5.005; ## requires this Perl version or later
1N/A
1N/Ause Pod::ParseUtils; ## for hyperlinks and lists
1N/A
1N/A=head1 NAME
1N/A
1N/APod::Checker, podchecker() - check pod documents for syntax errors
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use Pod::Checker;
1N/A
1N/A $syntax_okay = podchecker($filepath, $outputpath, %options);
1N/A
1N/A my $checker = new Pod::Checker %options;
1N/A $checker->parse_from_file($filepath, \*STDERR);
1N/A
1N/A=head1 OPTIONS/ARGUMENTS
1N/A
1N/AC<$filepath> is the input POD to read and C<$outputpath> is
1N/Awhere to write POD syntax error messages. Either argument may be a scalar
1N/Aindicating a file-path, or else a reference to an open filehandle.
1N/AIf unspecified, the input-file it defaults to C<\*STDIN>, and
1N/Athe output-file defaults to C<\*STDERR>.
1N/A
1N/A=head2 podchecker()
1N/A
1N/AThis function can take a hash of options:
1N/A
1N/A=over 4
1N/A
1N/A=item B<-warnings> =E<gt> I<val>
1N/A
1N/ATurn warnings on/off. I<val> is usually 1 for on, but higher values
1N/Atrigger additional warnings. See L<"Warnings">.
1N/A
1N/A=back
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AB<podchecker> will perform syntax checking of Perl5 POD format documentation.
1N/A
1N/ACurious/ambitious users are welcome to propose additional features they wish
1N/Ato see in B<Pod::Checker> and B<podchecker> and verify that the checks are
1N/Aconsistent with L<perlpod>.
1N/A
1N/AThe following checks are currently preformed:
1N/A
1N/A=over 4
1N/A
1N/A=item *
1N/A
1N/AUnknown '=xxxx' commands, unknown 'XE<lt>...E<gt>' interior-sequences,
1N/Aand unterminated interior sequences.
1N/A
1N/A=item *
1N/A
1N/ACheck for proper balancing of C<=begin> and C<=end>. The contents of such
1N/Aa block are generally ignored, i.e. no syntax checks are performed.
1N/A
1N/A=item *
1N/A
1N/ACheck for proper nesting and balancing of C<=over>, C<=item> and C<=back>.
1N/A
1N/A=item *
1N/A
1N/ACheck for same nested interior-sequences (e.g.
1N/AC<LE<lt>...LE<lt>...E<gt>...E<gt>>).
1N/A
1N/A=item *
1N/A
1N/ACheck for malformed or nonexisting entities C<EE<lt>...E<gt>>.
1N/A
1N/A=item *
1N/A
1N/ACheck for correct syntax of hyperlinks C<LE<lt>...E<gt>>. See L<perlpod>
1N/Afor details.
1N/A
1N/A=item *
1N/A
1N/ACheck for unresolved document-internal links. This check may also reveal
1N/Amisspelled links that seem to be internal links but should be links
1N/Ato something else.
1N/A
1N/A=back
1N/A
1N/A=head1 DIAGNOSTICS
1N/A
1N/A=head2 Errors
1N/A
1N/A=over 4
1N/A
1N/A=item * empty =headn
1N/A
1N/AA heading (C<=head1> or C<=head2>) without any text? That ain't no
1N/Aheading!
1N/A
1N/A=item * =over on line I<N> without closing =back
1N/A
1N/AThe C<=over> command does not have a corresponding C<=back> before the
1N/Anext heading (C<=head1> or C<=head2>) or the end of the file.
1N/A
1N/A=item * =item without previous =over
1N/A
1N/A=item * =back without previous =over
1N/A
1N/AAn C<=item> or C<=back> command has been found outside a
1N/AC<=over>/C<=back> block.
1N/A
1N/A=item * No argument for =begin
1N/A
1N/AA C<=begin> command was found that is not followed by the formatter
1N/Aspecification.
1N/A
1N/A=item * =end without =begin
1N/A
1N/AA standalone C<=end> command was found.
1N/A
1N/A=item * Nested =begin's
1N/A
1N/AThere were at least two consecutive C<=begin> commands without
1N/Athe corresponding C<=end>. Only one C<=begin> may be active at
1N/Aa time.
1N/A
1N/A=item * =for without formatter specification
1N/A
1N/AThere is no specification of the formatter after the C<=for> command.
1N/A
1N/A=item * unresolved internal link I<NAME>
1N/A
1N/AThe given link to I<NAME> does not have a matching node in the current
1N/APOD. This also happend when a single word node name is not enclosed in
1N/AC<"">.
1N/A
1N/A=item * Unknown command "I<CMD>"
1N/A
1N/AAn invalid POD command has been found. Valid are C<=head1>, C<=head2>,
1N/AC<=head3>, C<=head4>, C<=over>, C<=item>, C<=back>, C<=begin>, C<=end>,
1N/AC<=for>, C<=pod>, C<=cut>
1N/A
1N/A=item * Unknown interior-sequence "I<SEQ>"
1N/A
1N/AAn invalid markup command has been encountered. Valid are:
1N/AC<BE<lt>E<gt>>, C<CE<lt>E<gt>>, C<EE<lt>E<gt>>, C<FE<lt>E<gt>>,
1N/AC<IE<lt>E<gt>>, C<LE<lt>E<gt>>, C<SE<lt>E<gt>>, C<XE<lt>E<gt>>,
1N/AC<ZE<lt>E<gt>>
1N/A
1N/A=item * nested commands I<CMD>E<lt>...I<CMD>E<lt>...E<gt>...E<gt>
1N/A
1N/ATwo nested identical markup commands have been found. Generally this
1N/Adoes not make sense.
1N/A
1N/A=item * garbled entity I<STRING>
1N/A
1N/AThe I<STRING> found cannot be interpreted as a character entity.
1N/A
1N/A=item * Entity number out of range
1N/A
1N/AAn entity specified by number (dec, hex, oct) is out of range (1-255).
1N/A
1N/A=item * malformed link LE<lt>E<gt>
1N/A
1N/AThe link found cannot be parsed because it does not conform to the
1N/Asyntax described in L<perlpod>.
1N/A
1N/A=item * nonempty ZE<lt>E<gt>
1N/A
1N/AThe C<ZE<lt>E<gt>> sequence is supposed to be empty.
1N/A
1N/A=item * empty XE<lt>E<gt>
1N/A
1N/AThe index entry specified contains nothing but whitespace.
1N/A
1N/A=item * Spurious text after =pod / =cut
1N/A
1N/AThe commands C<=pod> and C<=cut> do not take any arguments.
1N/A
1N/A=item * Spurious character(s) after =back
1N/A
1N/AThe C<=back> command does not take any arguments.
1N/A
1N/A=back
1N/A
1N/A=head2 Warnings
1N/A
1N/AThese may not necessarily cause trouble, but indicate mediocre style.
1N/A
1N/A=over 4
1N/A
1N/A=item * multiple occurrence of link target I<name>
1N/A
1N/AThe POD file has some C<=item> and/or C<=head> commands that have
1N/Athe same text. Potential hyperlinks to such a text cannot be unique then.
1N/A
1N/A=item * line containing nothing but whitespace in paragraph
1N/A
1N/AThere is some whitespace on a seemingly empty line. POD is very sensitive
1N/Ato such things, so this is flagged. B<vi> users switch on the B<list>
1N/Aoption to avoid this problem.
1N/A
1N/A=begin _disabled_
1N/A
1N/A=item * file does not start with =head
1N/A
1N/AThe file starts with a different POD directive than head.
1N/AThis is most probably something you do not want.
1N/A
1N/A=end _disabled_
1N/A
1N/A=item * previous =item has no contents
1N/A
1N/AThere is a list C<=item> right above the flagged line that has no
1N/Atext contents. You probably want to delete empty items.
1N/A
1N/A=item * preceding non-item paragraph(s)
1N/A
1N/AA list introduced by C<=over> starts with a text or verbatim paragraph,
1N/Abut continues with C<=item>s. Move the non-item paragraph out of the
1N/AC<=over>/C<=back> block.
1N/A
1N/A=item * =item type mismatch (I<one> vs. I<two>)
1N/A
1N/AA list started with e.g. a bulletted C<=item> and continued with a
1N/Anumbered one. This is obviously inconsistent. For most translators the
1N/Atype of the I<first> C<=item> determines the type of the list.
1N/A
1N/A=item * I<N> unescaped C<E<lt>E<gt>> in paragraph
1N/A
1N/AAngle brackets not written as C<E<lt>ltE<gt>> and C<E<lt>gtE<gt>>
1N/Acan potentially cause errors as they could be misinterpreted as
1N/Amarkup commands. This is only printed when the -warnings level is
1N/Agreater than 1.
1N/A
1N/A=item * Unknown entity
1N/A
1N/AA character entity was found that does not belong to the standard
1N/AISO set or the POD specials C<verbar> and C<sol>.
1N/A
1N/A=item * No items in =over
1N/A
1N/AThe list opened with C<=over> does not contain any items.
1N/A
1N/A=item * No argument for =item
1N/A
1N/AC<=item> without any parameters is deprecated. It should either be followed
1N/Aby C<*> to indicate an unordered list, by a number (optionally followed
1N/Aby a dot) to indicate an ordered (numbered) list or simple text for a
1N/Adefinition list.
1N/A
1N/A=item * empty section in previous paragraph
1N/A
1N/AThe previous section (introduced by a C<=head> command) does not contain
1N/Aany text. This usually indicates that something is missing. Note: A
1N/AC<=head1> followed immediately by C<=head2> does not trigger this warning.
1N/A
1N/A=item * Verbatim paragraph in NAME section
1N/A
1N/AThe NAME section (C<=head1 NAME>) should consist of a single paragraph
1N/Awith the script/module name, followed by a dash `-' and a very short
1N/Adescription of what the thing is good for.
1N/A
1N/A=item * =headI<n> without preceding higher level
1N/A
1N/AFor example if there is a C<=head2> in the POD file prior to a
1N/AC<=head1>.
1N/A
1N/A=back
1N/A
1N/A=head2 Hyperlinks
1N/A
1N/AThere are some warnings wrt. malformed hyperlinks.
1N/A
1N/A=over 4
1N/A
1N/A=item * ignoring leading/trailing whitespace in link
1N/A
1N/AThere is whitespace at the beginning or the end of the contents of
1N/ALE<lt>...E<gt>.
1N/A
1N/A=item * (section) in '$page' deprecated
1N/A
1N/AThere is a section detected in the page name of LE<lt>...E<gt>, e.g.
1N/AC<LE<lt>passwd(2)E<gt>>. POD hyperlinks may point to POD documents only.
1N/APlease write C<CE<lt>passwd(2)E<gt>> instead. Some formatters are able
1N/Ato expand this to appropriate code. For links to (builtin) functions,
1N/Aplease say C<LE<lt>perlfunc/mkdirE<gt>>, without ().
1N/A
1N/A=item * alternative text/node '%s' contains non-escaped | or /
1N/A
1N/AThe characters C<|> and C</> are special in the LE<lt>...E<gt> context.
1N/AAlthough the hyperlink parser does its best to determine which "/" is
1N/Atext and which is a delimiter in case of doubt, one ought to escape
1N/Athese literal characters like this:
1N/A
1N/A / E<sol>
1N/A | E<verbar>
1N/A
1N/A=back
1N/A
1N/A=head1 RETURN VALUE
1N/A
1N/AB<podchecker> returns the number of POD syntax errors found or -1 if
1N/Athere were no POD commands at all found in the file.
1N/A
1N/A=head1 EXAMPLES
1N/A
1N/ASee L</SYNOPSIS>
1N/A
1N/A=head1 INTERFACE
1N/A
1N/AWhile checking, this module collects document properties, e.g. the nodes
1N/Afor hyperlinks (C<=headX>, C<=item>) and index entries (C<XE<lt>E<gt>>).
1N/APOD translators can use this feature to syntax-check and get the nodes in
1N/Aa first pass before actually starting to convert. This is expensive in terms
1N/Aof execution time, but allows for very robust conversions.
1N/A
1N/ASince PodParser-1.24 the B<Pod::Checker> module uses only the B<poderror>
1N/Amethod to print errors and warnings. The summary output (e.g.
1N/A"Pod syntax OK") has been dropped from the module and has been included in
1N/AB<podchecker> (the script). This allows users of B<Pod::Checker> to
1N/Acontrol completely the output behaviour. Users of B<podchecker> (the script)
1N/Aget the well-known behaviour.
1N/A
1N/A=cut
1N/A
1N/A#############################################################################
1N/A
1N/Ause strict;
1N/A#use diagnostics;
1N/Ause Carp;
1N/Ause Exporter;
1N/Ause Pod::Parser;
1N/A
1N/Ause vars qw(@ISA @EXPORT);
1N/A@ISA = qw(Pod::Parser);
1N/A@EXPORT = qw(&podchecker);
1N/A
1N/Ause vars qw(%VALID_COMMANDS %VALID_SEQUENCES);
1N/A
1N/Amy %VALID_COMMANDS = (
1N/A 'pod' => 1,
1N/A 'cut' => 1,
1N/A 'head1' => 1,
1N/A 'head2' => 1,
1N/A 'head3' => 1,
1N/A 'head4' => 1,
1N/A 'over' => 1,
1N/A 'back' => 1,
1N/A 'item' => 1,
1N/A 'for' => 1,
1N/A 'begin' => 1,
1N/A 'end' => 1,
1N/A);
1N/A
1N/Amy %VALID_SEQUENCES = (
1N/A 'I' => 1,
1N/A 'B' => 1,
1N/A 'S' => 1,
1N/A 'C' => 1,
1N/A 'L' => 1,
1N/A 'F' => 1,
1N/A 'X' => 1,
1N/A 'Z' => 1,
1N/A 'E' => 1,
1N/A);
1N/A
1N/A# stolen from HTML::Entities
1N/Amy %ENTITIES = (
1N/A # Some normal chars that have special meaning in SGML context
1N/A amp => '&', # ampersand
1N/A'gt' => '>', # greater than
1N/A'lt' => '<', # less than
1N/A quot => '"', # double quote
1N/A
1N/A # PUBLIC ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML
1N/A AElig => '�', # capital AE diphthong (ligature)
1N/A Aacute => '�', # capital A, acute accent
1N/A Acirc => '�', # capital A, circumflex accent
1N/A Agrave => '�', # capital A, grave accent
1N/A Aring => '�', # capital A, ring
1N/A Atilde => '�', # capital A, tilde
1N/A Auml => '�', # capital A, dieresis or umlaut mark
1N/A Ccedil => '�', # capital C, cedilla
1N/A ETH => '�', # capital Eth, Icelandic
1N/A Eacute => '�', # capital E, acute accent
1N/A Ecirc => '�', # capital E, circumflex accent
1N/A Egrave => '�', # capital E, grave accent
1N/A Euml => '�', # capital E, dieresis or umlaut mark
1N/A Iacute => '�', # capital I, acute accent
1N/A Icirc => '�', # capital I, circumflex accent
1N/A Igrave => '�', # capital I, grave accent
1N/A Iuml => '�', # capital I, dieresis or umlaut mark
1N/A Ntilde => '�', # capital N, tilde
1N/A Oacute => '�', # capital O, acute accent
1N/A Ocirc => '�', # capital O, circumflex accent
1N/A Ograve => '�', # capital O, grave accent
1N/A Oslash => '�', # capital O, slash
1N/A Otilde => '�', # capital O, tilde
1N/A Ouml => '�', # capital O, dieresis or umlaut mark
1N/A THORN => '�', # capital THORN, Icelandic
1N/A Uacute => '�', # capital U, acute accent
1N/A Ucirc => '�', # capital U, circumflex accent
1N/A Ugrave => '�', # capital U, grave accent
1N/A Uuml => '�', # capital U, dieresis or umlaut mark
1N/A Yacute => '�', # capital Y, acute accent
1N/A aacute => '�', # small a, acute accent
1N/A acirc => '�', # small a, circumflex accent
1N/A aelig => '�', # small ae diphthong (ligature)
1N/A agrave => '�', # small a, grave accent
1N/A aring => '�', # small a, ring
1N/A atilde => '�', # small a, tilde
1N/A auml => '�', # small a, dieresis or umlaut mark
1N/A ccedil => '�', # small c, cedilla
1N/A eacute => '�', # small e, acute accent
1N/A ecirc => '�', # small e, circumflex accent
1N/A egrave => '�', # small e, grave accent
1N/A eth => '�', # small eth, Icelandic
1N/A euml => '�', # small e, dieresis or umlaut mark
1N/A iacute => '�', # small i, acute accent
1N/A icirc => '�', # small i, circumflex accent
1N/A igrave => '�', # small i, grave accent
1N/A iuml => '�', # small i, dieresis or umlaut mark
1N/A ntilde => '�', # small n, tilde
1N/A oacute => '�', # small o, acute accent
1N/A ocirc => '�', # small o, circumflex accent
1N/A ograve => '�', # small o, grave accent
1N/A oslash => '�', # small o, slash
1N/A otilde => '�', # small o, tilde
1N/A ouml => '�', # small o, dieresis or umlaut mark
1N/A szlig => '�', # small sharp s, German (sz ligature)
1N/A thorn => '�', # small thorn, Icelandic
1N/A uacute => '�', # small u, acute accent
1N/A ucirc => '�', # small u, circumflex accent
1N/A ugrave => '�', # small u, grave accent
1N/A uuml => '�', # small u, dieresis or umlaut mark
1N/A yacute => '�', # small y, acute accent
1N/A yuml => '�', # small y, dieresis or umlaut mark
1N/A
1N/A # Some extra Latin 1 chars that are listed in the HTML3.2 draft (21-May-96)
1N/A copy => '�', # copyright sign
1N/A reg => '�', # registered sign
1N/A nbsp => "\240", # non breaking space
1N/A
1N/A # Additional ISO-8859/1 entities listed in rfc1866 (section 14)
1N/A iexcl => '�',
1N/A cent => '�',
1N/A pound => '�',
1N/A curren => '�',
1N/A yen => '�',
1N/A brvbar => '�',
1N/A sect => '�',
1N/A uml => '�',
1N/A ordf => '�',
1N/A laquo => '�',
1N/A'not' => '�', # not is a keyword in perl
1N/A shy => '�',
1N/A macr => '�',
1N/A deg => '�',
1N/A plusmn => '�',
1N/A sup1 => '�',
1N/A sup2 => '�',
1N/A sup3 => '�',
1N/A acute => '�',
1N/A micro => '�',
1N/A para => '�',
1N/A middot => '�',
1N/A cedil => '�',
1N/A ordm => '�',
1N/A raquo => '�',
1N/A frac14 => '�',
1N/A frac12 => '�',
1N/A frac34 => '�',
1N/A iquest => '�',
1N/A'times' => '�', # times is a keyword in perl
1N/A divide => '�',
1N/A
1N/A# some POD special entities
1N/A verbar => '|',
1N/A sol => '/'
1N/A);
1N/A
1N/A##---------------------------------------------------------------------------
1N/A
1N/A##---------------------------------
1N/A## Function definitions begin here
1N/A##---------------------------------
1N/A
1N/Asub podchecker( $ ; $ % ) {
1N/A my ($infile, $outfile, %options) = @_;
1N/A local $_;
1N/A
1N/A ## Set defaults
1N/A $infile ||= \*STDIN;
1N/A $outfile ||= \*STDERR;
1N/A
1N/A ## Now create a pod checker
1N/A my $checker = new Pod::Checker(%options);
1N/A
1N/A ## Now check the pod document for errors
1N/A $checker->parse_from_file($infile, $outfile);
1N/A
1N/A ## Return the number of errors found
1N/A return $checker->num_errors();
1N/A}
1N/A
1N/A##---------------------------------------------------------------------------
1N/A
1N/A##-------------------------------
1N/A## Method definitions begin here
1N/A##-------------------------------
1N/A
1N/A##################################
1N/A
1N/A=over 4
1N/A
1N/A=item C<Pod::Checker-E<gt>new( %options )>
1N/A
1N/AReturn a reference to a new Pod::Checker object that inherits from
1N/APod::Parser and is used for calling the required methods later. The
1N/Afollowing options are recognized:
1N/A
1N/AC<-warnings =E<gt> num>
1N/A Print warnings if C<num> is true. The higher the value of C<num>,
1N/Athe more warnings are printed. Currently there are only levels 1 and 2.
1N/A
1N/AC<-quiet =E<gt> num>
1N/A If C<num> is true, do not print any errors/warnings. This is useful
1N/Awhen Pod::Checker is used to munge POD code into plain text from within
1N/APOD formatters.
1N/A
1N/A=cut
1N/A
1N/A## sub new {
1N/A## my $this = shift;
1N/A## my $class = ref($this) || $this;
1N/A## my %params = @_;
1N/A## my $self = {%params};
1N/A## bless $self, $class;
1N/A## $self->initialize();
1N/A## return $self;
1N/A## }
1N/A
1N/Asub initialize {
1N/A my $self = shift;
1N/A ## Initialize number of errors, and setup an error function to
1N/A ## increment this number and then print to the designated output.
1N/A $self->{_NUM_ERRORS} = 0;
1N/A $self->{_NUM_WARNINGS} = 0;
1N/A $self->{-quiet} ||= 0;
1N/A # set the error handling subroutine
1N/A $self->errorsub($self->{-quiet} ? sub { 1; } : 'poderror');
1N/A $self->{_commands} = 0; # total number of POD commands encountered
1N/A $self->{_list_stack} = []; # stack for nested lists
1N/A $self->{_have_begin} = ''; # stores =begin
1N/A $self->{_links} = []; # stack for internal hyperlinks
1N/A $self->{_nodes} = []; # stack for =head/=item nodes
1N/A $self->{_index} = []; # text in X<>
1N/A # print warnings?
1N/A $self->{-warnings} = 1 unless(defined $self->{-warnings});
1N/A $self->{_current_head1} = ''; # the current =head1 block
1N/A $self->parseopts(-process_cut_cmd => 1, -warnings => $self->{-warnings});
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>poderror( @args )>
1N/A
1N/A=item C<$checker-E<gt>poderror( {%opts}, @args )>
1N/A
1N/AInternal method for printing errors and warnings. If no options are
1N/Agiven, simply prints "@_". The following options are recognized and used
1N/Ato form the output:
1N/A
1N/A -msg
1N/A
1N/AA message to print prior to C<@args>.
1N/A
1N/A -line
1N/A
1N/AThe line number the error occurred in.
1N/A
1N/A -file
1N/A
1N/AThe file (name) the error occurred in.
1N/A
1N/A -severity
1N/A
1N/AThe error level, should be 'WARNING' or 'ERROR'.
1N/A
1N/A=cut
1N/A
1N/A# Invoked as $self->poderror( @args ), or $self->poderror( {%opts}, @args )
1N/Asub poderror {
1N/A my $self = shift;
1N/A my %opts = (ref $_[0]) ? %{shift()} : ();
1N/A
1N/A ## Retrieve options
1N/A chomp( my $msg = ($opts{-msg} || "")."@_" );
1N/A my $line = (exists $opts{-line}) ? " at line $opts{-line}" : "";
1N/A my $file = (exists $opts{-file}) ? " in file $opts{-file}" : "";
1N/A unless (exists $opts{-severity}) {
1N/A ## See if can find severity in message prefix
1N/A $opts{-severity} = $1 if ( $msg =~ s/^\**\s*([A-Z]{3,}):\s+// );
1N/A }
1N/A my $severity = (exists $opts{-severity}) ? "*** $opts{-severity}: " : "";
1N/A
1N/A ## Increment error count and print message "
1N/A ++($self->{_NUM_ERRORS})
1N/A if(!%opts || ($opts{-severity} && $opts{-severity} eq 'ERROR'));
1N/A ++($self->{_NUM_WARNINGS})
1N/A if(!%opts || ($opts{-severity} && $opts{-severity} eq 'WARNING'));
1N/A my $out_fh = $self->output_handle() || \*STDERR;
1N/A print $out_fh ($severity, $msg, $line, $file, "\n")
1N/A if($self->{-warnings} || !%opts || $opts{-severity} ne 'WARNING');
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>num_errors()>
1N/A
1N/ASet (if argument specified) and retrieve the number of errors found.
1N/A
1N/A=cut
1N/A
1N/Asub num_errors {
1N/A return (@_ > 1) ? ($_[0]->{_NUM_ERRORS} = $_[1]) : $_[0]->{_NUM_ERRORS};
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>num_warnings()>
1N/A
1N/ASet (if argument specified) and retrieve the number of warnings found.
1N/A
1N/A=cut
1N/A
1N/Asub num_warnings {
1N/A return (@_ > 1) ? ($_[0]->{_NUM_WARNINGS} = $_[1]) : $_[0]->{_NUM_WARNINGS};
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>name()>
1N/A
1N/ASet (if argument specified) and retrieve the canonical name of POD as
1N/Afound in the C<=head1 NAME> section.
1N/A
1N/A=cut
1N/A
1N/Asub name {
1N/A return (@_ > 1 && $_[1]) ?
1N/A ($_[0]->{-name} = $_[1]) : $_[0]->{-name};
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>node()>
1N/A
1N/AAdd (if argument specified) and retrieve the nodes (as defined by C<=headX>
1N/Aand C<=item>) of the current POD. The nodes are returned in the order of
1N/Atheir occurrence. They consist of plain text, each piece of whitespace is
1N/Acollapsed to a single blank.
1N/A
1N/A=cut
1N/A
1N/Asub node {
1N/A my ($self,$text) = @_;
1N/A if(defined $text) {
1N/A $text =~ s/\s+$//s; # strip trailing whitespace
1N/A $text =~ s/\s+/ /gs; # collapse whitespace
1N/A # add node, order important!
1N/A push(@{$self->{_nodes}}, $text);
1N/A # keep also a uniqueness counter
1N/A $self->{_unique_nodes}->{$text}++ if($text !~ /^\s*$/s);
1N/A return $text;
1N/A }
1N/A @{$self->{_nodes}};
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>idx()>
1N/A
1N/AAdd (if argument specified) and retrieve the index entries (as defined by
1N/AC<XE<lt>E<gt>>) of the current POD. They consist of plain text, each piece
1N/Aof whitespace is collapsed to a single blank.
1N/A
1N/A=cut
1N/A
1N/A# set/return index entries of current POD
1N/Asub idx {
1N/A my ($self,$text) = @_;
1N/A if(defined $text) {
1N/A $text =~ s/\s+$//s; # strip trailing whitespace
1N/A $text =~ s/\s+/ /gs; # collapse whitespace
1N/A # add node, order important!
1N/A push(@{$self->{_index}}, $text);
1N/A # keep also a uniqueness counter
1N/A $self->{_unique_nodes}->{$text}++ if($text !~ /^\s*$/s);
1N/A return $text;
1N/A }
1N/A @{$self->{_index}};
1N/A}
1N/A
1N/A##################################
1N/A
1N/A=item C<$checker-E<gt>hyperlink()>
1N/A
1N/AAdd (if argument specified) and retrieve the hyperlinks (as defined by
1N/AC<LE<lt>E<gt>>) of the current POD. They consist of a 2-item array: line
1N/Anumber and C<Pod::Hyperlink> object.
1N/A
1N/A=back
1N/A
1N/A=cut
1N/A
1N/A# set/return hyperlinks of the current POD
1N/Asub hyperlink {
1N/A my $self = shift;
1N/A if($_[0]) {
1N/A push(@{$self->{_links}}, $_[0]);
1N/A return $_[0];
1N/A }
1N/A @{$self->{_links}};
1N/A}
1N/A
1N/A## overrides for Pod::Parser
1N/A
1N/Asub end_pod {
1N/A ## Do some final checks and
1N/A ## print the number of errors found
1N/A my $self = shift;
1N/A my $infile = $self->input_file();
1N/A my $out_fh = $self->output_handle();
1N/A
1N/A if(@{$self->{_list_stack}}) {
1N/A my $list;
1N/A while(($list = $self->_close_list('EOF',$infile)) &&
1N/A $list->indent() ne 'auto') {
1N/A $self->poderror({ -line => 'EOF', -file => $infile,
1N/A -severity => 'ERROR', -msg => "=over on line " .
1N/A $list->start() . " without closing =back" }); #"
1N/A }
1N/A }
1N/A
1N/A # check validity of document internal hyperlinks
1N/A # first build the node names from the paragraph text
1N/A my %nodes;
1N/A foreach($self->node()) {
1N/A $nodes{$_} = 1;
1N/A if(/^(\S+)\s+\S/) {
1N/A # we have more than one word. Use the first as a node, too.
1N/A # This is used heavily in perlfunc.pod
1N/A $nodes{$1} ||= 2; # derived node
1N/A }
1N/A }
1N/A foreach($self->idx()) {
1N/A $nodes{$_} = 3; # index node
1N/A }
1N/A foreach($self->hyperlink()) {
1N/A my ($line,$link) = @$_;
1N/A # _TODO_ what if there is a link to the page itself by the name,
1N/A # e.g. in Tk::Pod : L<Tk::Pod/"DESCRIPTION">
1N/A if($link->node() && !$link->page() && $link->type() ne 'hyperlink') {
1N/A my $node = $self->_check_ptree($self->parse_text($link->node(),
1N/A $line), $line, $infile, 'L');
1N/A if($node && !$nodes{$node}) {
1N/A $self->poderror({ -line => $line || '', -file => $infile,
1N/A -severity => 'ERROR',
1N/A -msg => "unresolved internal link '$node'"});
1N/A }
1N/A }
1N/A }
1N/A
1N/A # check the internal nodes for uniqueness. This pertains to
1N/A # =headX, =item and X<...>
1N/A foreach(grep($self->{_unique_nodes}->{$_} > 1,
1N/A keys %{$self->{_unique_nodes}})) {
1N/A $self->poderror({ -line => '-', -file => $infile,
1N/A -severity => 'WARNING',
1N/A -msg => "multiple occurrence of link target '$_'"});
1N/A }
1N/A
1N/A # no POD found here
1N/A $self->num_errors(-1) if($self->{_commands} == 0);
1N/A}
1N/A
1N/A# check a POD command directive
1N/Asub command {
1N/A my ($self, $cmd, $paragraph, $line_num, $pod_para) = @_;
1N/A my ($file, $line) = $pod_para->file_line;
1N/A ## Check the command syntax
1N/A my $arg; # this will hold the command argument
1N/A if (! $VALID_COMMANDS{$cmd}) {
1N/A $self->poderror({ -line => $line, -file => $file, -severity => 'ERROR',
1N/A -msg => "Unknown command '$cmd'" });
1N/A }
1N/A else { # found a valid command
1N/A $self->{_commands}++; # delete this line if below is enabled again
1N/A
1N/A ##### following check disabled due to strong request
1N/A #if(!$self->{_commands}++ && $cmd !~ /^head/) {
1N/A # $self->poderror({ -line => $line, -file => $file,
1N/A # -severity => 'WARNING',
1N/A # -msg => "file does not start with =head" });
1N/A #}
1N/A
1N/A # check syntax of particular command
1N/A if($cmd eq 'over') {
1N/A # check for argument
1N/A $arg = $self->interpolate_and_check($paragraph, $line,$file);
1N/A my $indent = 4; # default
1N/A if($arg && $arg =~ /^\s*(\d+)\s*$/) {
1N/A $indent = $1;
1N/A }
1N/A # start a new list
1N/A $self->_open_list($indent,$line,$file);
1N/A }
1N/A elsif($cmd eq 'item') {
1N/A # are we in a list?
1N/A unless(@{$self->{_list_stack}}) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "=item without previous =over" });
1N/A # auto-open in case we encounter many more
1N/A $self->_open_list('auto',$line,$file);
1N/A }
1N/A my $list = $self->{_list_stack}->[0];
1N/A # check whether the previous item had some contents
1N/A if(defined $self->{_list_item_contents} &&
1N/A $self->{_list_item_contents} == 0) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "previous =item has no contents" });
1N/A }
1N/A if($list->{_has_par}) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "preceding non-item paragraph(s)" });
1N/A delete $list->{_has_par};
1N/A }
1N/A # check for argument
1N/A $arg = $self->interpolate_and_check($paragraph, $line, $file);
1N/A if($arg && $arg =~ /(\S+)/) {
1N/A $arg =~ s/[\s\n]+$//;
1N/A my $type;
1N/A if($arg =~ /^[*]\s*(\S*.*)/) {
1N/A $type = 'bullet';
1N/A $self->{_list_item_contents} = $1 ? 1 : 0;
1N/A $arg = $1;
1N/A }
1N/A elsif($arg =~ /^\d+\.?\s*(\S*)/) {
1N/A $type = 'number';
1N/A $self->{_list_item_contents} = $1 ? 1 : 0;
1N/A $arg = $1;
1N/A }
1N/A else {
1N/A $type = 'definition';
1N/A $self->{_list_item_contents} = 1;
1N/A }
1N/A my $first = $list->type();
1N/A if($first && $first ne $type) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "=item type mismatch ('$first' vs. '$type')"});
1N/A }
1N/A else { # first item
1N/A $list->type($type);
1N/A }
1N/A }
1N/A else {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "No argument for =item" });
1N/A $arg = ' '; # empty
1N/A $self->{_list_item_contents} = 0;
1N/A }
1N/A # add this item
1N/A $list->item($arg);
1N/A # remember this node
1N/A $self->node($arg);
1N/A }
1N/A elsif($cmd eq 'back') {
1N/A # check if we have an open list
1N/A unless(@{$self->{_list_stack}}) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "=back without previous =over" });
1N/A }
1N/A else {
1N/A # check for spurious characters
1N/A $arg = $self->interpolate_and_check($paragraph, $line,$file);
1N/A if($arg && $arg =~ /\S/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "Spurious character(s) after =back" });
1N/A }
1N/A # close list
1N/A my $list = $self->_close_list($line,$file);
1N/A # check for empty lists
1N/A if(!$list->item() && $self->{-warnings}) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "No items in =over (at line " .
1N/A $list->start() . ") / =back list"}); #"
1N/A }
1N/A }
1N/A }
1N/A elsif($cmd =~ /^head(\d+)/) {
1N/A my $hnum = $1;
1N/A $self->{"_have_head_$hnum"}++; # count head types
1N/A if($hnum > 1 && !$self->{"_have_head_".($hnum -1)}) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "=head$hnum without preceding higher level"});
1N/A }
1N/A # check whether the previous =head section had some contents
1N/A if(defined $self->{_commands_in_head} &&
1N/A $self->{_commands_in_head} == 0 &&
1N/A defined $self->{_last_head} &&
1N/A $self->{_last_head} >= $hnum) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "empty section in previous paragraph"});
1N/A }
1N/A $self->{_commands_in_head} = -1;
1N/A $self->{_last_head} = $hnum;
1N/A # check if there is an open list
1N/A if(@{$self->{_list_stack}}) {
1N/A my $list;
1N/A while(($list = $self->_close_list($line,$file)) &&
1N/A $list->indent() ne 'auto') {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "=over on line ". $list->start() .
1N/A " without closing =back (at $cmd)" });
1N/A }
1N/A }
1N/A # remember this node
1N/A $arg = $self->interpolate_and_check($paragraph, $line,$file);
1N/A $arg =~ s/[\s\n]+$//s;
1N/A $self->node($arg);
1N/A unless(length($arg)) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "empty =$cmd"});
1N/A }
1N/A if($cmd eq 'head1') {
1N/A $self->{_current_head1} = $arg;
1N/A } else {
1N/A $self->{_current_head1} = '';
1N/A }
1N/A }
1N/A elsif($cmd eq 'begin') {
1N/A if($self->{_have_begin}) {
1N/A # already have a begin
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "Nested =begin's (first at line " .
1N/A $self->{_have_begin} . ")"});
1N/A }
1N/A else {
1N/A # check for argument
1N/A $arg = $self->interpolate_and_check($paragraph, $line,$file);
1N/A unless($arg && $arg =~ /(\S+)/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "No argument for =begin"});
1N/A }
1N/A # remember the =begin
1N/A $self->{_have_begin} = "$line:$1";
1N/A }
1N/A }
1N/A elsif($cmd eq 'end') {
1N/A if($self->{_have_begin}) {
1N/A # close the existing =begin
1N/A $self->{_have_begin} = '';
1N/A # check for spurious characters
1N/A $arg = $self->interpolate_and_check($paragraph, $line,$file);
1N/A # the closing argument is optional
1N/A #if($arg && $arg =~ /\S/) {
1N/A # $self->poderror({ -line => $line, -file => $file,
1N/A # -severity => 'WARNING',
1N/A # -msg => "Spurious character(s) after =end" });
1N/A #}
1N/A }
1N/A else {
1N/A # don't have a matching =begin
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "=end without =begin" });
1N/A }
1N/A }
1N/A elsif($cmd eq 'for') {
1N/A unless($paragraph =~ /\s*(\S+)\s*/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "=for without formatter specification" });
1N/A }
1N/A $arg = ''; # do not expand paragraph below
1N/A }
1N/A elsif($cmd =~ /^(pod|cut)$/) {
1N/A # check for argument
1N/A $arg = $self->interpolate_and_check($paragraph, $line,$file);
1N/A if($arg && $arg =~ /(\S+)/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "Spurious text after =$cmd"});
1N/A }
1N/A }
1N/A $self->{_commands_in_head}++;
1N/A ## Check the interior sequences in the command-text
1N/A $self->interpolate_and_check($paragraph, $line,$file)
1N/A unless(defined $arg);
1N/A }
1N/A}
1N/A
1N/Asub _open_list
1N/A{
1N/A my ($self,$indent,$line,$file) = @_;
1N/A my $list = Pod::List->new(
1N/A -indent => $indent,
1N/A -start => $line,
1N/A -file => $file);
1N/A unshift(@{$self->{_list_stack}}, $list);
1N/A undef $self->{_list_item_contents};
1N/A $list;
1N/A}
1N/A
1N/Asub _close_list
1N/A{
1N/A my ($self,$line,$file) = @_;
1N/A my $list = shift(@{$self->{_list_stack}});
1N/A if(defined $self->{_list_item_contents} &&
1N/A $self->{_list_item_contents} == 0) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "previous =item has no contents" });
1N/A }
1N/A undef $self->{_list_item_contents};
1N/A $list;
1N/A}
1N/A
1N/A# process a block of some text
1N/Asub interpolate_and_check {
1N/A my ($self, $paragraph, $line, $file) = @_;
1N/A ## Check the interior sequences in the command-text
1N/A # and return the text
1N/A $self->_check_ptree(
1N/A $self->parse_text($paragraph,$line), $line, $file, '');
1N/A}
1N/A
1N/Asub _check_ptree {
1N/A my ($self,$ptree,$line,$file,$nestlist) = @_;
1N/A local($_);
1N/A my $text = '';
1N/A # process each node in the parse tree
1N/A foreach(@$ptree) {
1N/A # regular text chunk
1N/A unless(ref) {
1N/A # count the unescaped angle brackets
1N/A # complain only when warning level is greater than 1
1N/A if($self->{-warnings} && $self->{-warnings}>1) {
1N/A my $count;
1N/A if($count = tr/<>/<>/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "$count unescaped <> in paragraph" });
1N/A }
1N/A }
1N/A $text .= $_;
1N/A next;
1N/A }
1N/A # have an interior sequence
1N/A my $cmd = $_->cmd_name();
1N/A my $contents = $_->parse_tree();
1N/A ($file,$line) = $_->file_line();
1N/A # check for valid tag
1N/A if (! $VALID_SEQUENCES{$cmd}) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => qq(Unknown interior-sequence '$cmd')});
1N/A # expand it anyway
1N/A $text .= $self->_check_ptree($contents, $line, $file, "$nestlist$cmd");
1N/A next;
1N/A }
1N/A if($nestlist =~ /$cmd/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "nested commands $cmd<...$cmd<...>...>"});
1N/A # _TODO_ should we add the contents anyway?
1N/A # expand it anyway, see below
1N/A }
1N/A if($cmd eq 'E') {
1N/A # preserve entities
1N/A if(@$contents > 1 || ref $$contents[0] || $$contents[0] !~ /^\w+$/) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "garbled entity " . $_->raw_text()});
1N/A next;
1N/A }
1N/A my $ent = $$contents[0];
1N/A my $val;
1N/A if($ent =~ /^0x[0-9a-f]+$/i) {
1N/A # hexadec entity
1N/A $val = hex($ent);
1N/A }
1N/A elsif($ent =~ /^0\d+$/) {
1N/A # octal
1N/A $val = oct($ent);
1N/A }
1N/A elsif($ent =~ /^\d+$/) {
1N/A # numeric entity
1N/A $val = $ent;
1N/A }
1N/A if(defined $val) {
1N/A if($val>0 && $val<256) {
1N/A $text .= chr($val);
1N/A }
1N/A else {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "Entity number out of range " . $_->raw_text()});
1N/A }
1N/A }
1N/A elsif($ENTITIES{$ent}) {
1N/A # known ISO entity
1N/A $text .= $ENTITIES{$ent};
1N/A }
1N/A else {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => "Unknown entity " . $_->raw_text()});
1N/A $text .= "E<$ent>";
1N/A }
1N/A }
1N/A elsif($cmd eq 'L') {
1N/A # try to parse the hyperlink
1N/A my $link = Pod::Hyperlink->new($contents->raw_text());
1N/A unless(defined $link) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "malformed link " . $_->raw_text() ." : $@"});
1N/A next;
1N/A }
1N/A $link->line($line); # remember line
1N/A if($self->{-warnings}) {
1N/A foreach my $w ($link->warning()) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => $w });
1N/A }
1N/A }
1N/A # check the link text
1N/A $text .= $self->_check_ptree($self->parse_text($link->text(),
1N/A $line), $line, $file, "$nestlist$cmd");
1N/A # remember link
1N/A $self->hyperlink([$line,$link]);
1N/A }
1N/A elsif($cmd =~ /[BCFIS]/) {
1N/A # add the guts
1N/A $text .= $self->_check_ptree($contents, $line, $file, "$nestlist$cmd");
1N/A }
1N/A elsif($cmd eq 'Z') {
1N/A if(length($contents->raw_text())) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "Nonempty Z<>"});
1N/A }
1N/A }
1N/A elsif($cmd eq 'X') {
1N/A my $idx = $self->_check_ptree($contents, $line, $file, "$nestlist$cmd");
1N/A if($idx =~ /^\s*$/s) {
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'ERROR',
1N/A -msg => "Empty X<>"});
1N/A }
1N/A else {
1N/A # remember this node
1N/A $self->idx($idx);
1N/A }
1N/A }
1N/A else {
1N/A # not reached
1N/A die "internal error";
1N/A }
1N/A }
1N/A $text;
1N/A}
1N/A
1N/A# process a block of verbatim text
1N/Asub verbatim {
1N/A ## Nothing particular to check
1N/A my ($self, $paragraph, $line_num, $pod_para) = @_;
1N/A
1N/A $self->_preproc_par($paragraph);
1N/A
1N/A if($self->{_current_head1} eq 'NAME') {
1N/A my ($file, $line) = $pod_para->file_line;
1N/A $self->poderror({ -line => $line, -file => $file,
1N/A -severity => 'WARNING',
1N/A -msg => 'Verbatim paragraph in NAME section' });
1N/A }
1N/A}
1N/A
1N/A# process a block of regular text
1N/Asub textblock {
1N/A my ($self, $paragraph, $line_num, $pod_para) = @_;
1N/A my ($file, $line) = $pod_para->file_line;
1N/A
1N/A $self->_preproc_par($paragraph);
1N/A
1N/A # skip this paragraph if in a =begin block
1N/A unless($self->{_have_begin}) {
1N/A my $block = $self->interpolate_and_check($paragraph, $line,$file);
1N/A if($self->{_current_head1} eq 'NAME') {
1N/A if($block =~ /^\s*(\S+?)\s*[,-]/) {
1N/A # this is the canonical name
1N/A $self->{-name} = $1 unless(defined $self->{-name});
1N/A }
1N/A }
1N/A }
1N/A}
1N/A
1N/Asub _preproc_par
1N/A{
1N/A my $self = shift;
1N/A $_[0] =~ s/[\s\n]+$//;
1N/A if($_[0]) {
1N/A $self->{_commands_in_head}++;
1N/A $self->{_list_item_contents}++ if(defined $self->{_list_item_contents});
1N/A if(@{$self->{_list_stack}} && !$self->{_list_stack}->[0]->item()) {
1N/A $self->{_list_stack}->[0]->{_has_par} = 1;
1N/A }
1N/A }
1N/A}
1N/A
1N/A1;
1N/A
1N/A__END__
1N/A
1N/A=head1 AUTHOR
1N/A
1N/APlease report bugs using L<http://rt.cpan.org>.
1N/A
1N/ABrad Appleton E<lt>bradapp@enteract.comE<gt> (initial version),
1N/AMarek Rouchal E<lt>marekr@cpan.orgE<gt>
1N/A
1N/ABased on code for B<Pod::Text::pod2text()> written by
1N/ATom Christiansen E<lt>tchrist@mox.perl.comE<gt>
1N/A
1N/A=cut
1N/A