logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::Documentation::RequireEndBeforeLastPod - require __END__ before POD at end of file

Description

       This policy is part of the "Perl::Critic::Pulp" add-on.  It requires that you put an "__END__" before POD
       which is at the end of a file.  For example,

           program_code();
           1;
           __END__     # good

           =head1 NAME
           ...

       and not merely

           program_code();
           1;          # bad

           =head1 NAME
           ...

       This is primarily a matter of personal preference, so the policy is low severity and only under the
       "cosmetic" theme (see "POLICY THEMES" in Perl::Critic).  An "__END__" like this has no effect on
       execution, but it's a fairly common convention since it's a good human indication you mean the code to
       end there, and it stops Perl parsing through the POD which may save a few nanoseconds.

       This policy is looser than "Documentation::RequirePodAtEnd".  This policy allows POD to be anywhere in
       among the code, the requirement is only that if the file ends with POD then you should have an "__END__"
       between the last code and last POD.

       A file of all POD, or all code, or which ends with code, is ok.  Ending with code is usual if you write
       your POD at the start of the file or in among the functions etc,

           =pod

           And that's all.

           =cut

           cleanup ();
           exit 0;     # good

       A file using "__DATA__" is always ok, since you can't have "__END__" followed by "__DATA__", wherever you
       want your POD.  If the "__DATA__" is in fact "SelfLoader" code then it can helpfully have an "__END__"
       within it, but as of "perlcritic" version 1.092 no checks at all are applied to SelfLoader sections.

   Disabling
       As always if you don't care about "__END__" you can disable "RequireEndBeforeLastPod" from your
       .perlcriticrc in the usual way (see "CONFIGURATION" in Perl::Critic),

           [-Documentation::RequireEndBeforeLastPod]

Home Page

Name

       Perl::Critic::Policy::Documentation::RequireEndBeforeLastPod - require __END__ before POD at end of file

See Also

       Perl::Critic::Pulp, Perl::Critic, Perl::Critic::Policy::Documentation::RequirePodAtEnd

See Also