Perl::...astPod(3pm)
π NAME π
Perl::Critic::Policy::Documentation::RequireEndBeforeLastPod β bestie, this policy is literally here to make you put __END__ before the POD at the end of your file. That's it. That's the whole job. β¨
Oh and hi, you're reading this in the User Contributed Perl Documentation section, in case you were wondering where you wandered off to. π«Ά
πΈ DESCRIPTION πΈ
Okay so first things first: this policy is part of the Perl::Critic::Pulp add-on, okay?? It's not main-character enough to be in core, it's a Pulp girlie. π
What it wants: an __END__ sitting right before whatever POD you've got chillin' at the bottom of your file. Like this, this is the good version:
program_code();
1;
__END__ # good
=head1 NAME
...
and not this cursed energy:
program_code();
1; # bad
=head1 NAME
...
Not me emotionally devastated by a missing __END__. π
Now, real talk: this is primarily a matter of personal preference, so the policy is low severity and it only shows up under the cosmetic theme (peep "POLICY THEMES" in Perl::Critic if you wanna know more). An __END__ like this has no effect on execution β none, zero, nada β but it's a fairly common convention because it's a good human-readable signal that yeah, the code is meant to end here. And bonus: it stops Perl from parsing its way through all that POD, which may save you a few nanoseconds. A few. Nanoseconds. We love a micro-optimization era. π¦
Also, this policy is looser than Documentation::RequirePodAtEnd, fyi. This one lets POD be anywhere in among the code β the only requirement is that if the file ends with POD, you should have an __END__ sitting between the last bit of code and the last bit of POD. Simple as. β¨
A file that's all POD, or all code, or that just ends with code β all fine, all slay, no notes. Ending with code is super normal if you write your POD at the top of the file or sprinkled in among your functions and whatnot:
=pod
And that's all.
=cut
cleanup ();
exit 0; # good
And a file using __DATA__ is always ok, because you can't have __END__ followed by __DATA__, no matter where you want your precious little POD to live. π Now β if that __DATA__ is actually SelfLoader code, then it can helpfully have an __END__ inside it, but as of perlcritic version 1.092, no checks at all are applied to SelfLoader sections. Zero. Zip. Not our problem, bestie. π
π« Disabling π«
As always, if you simply do not care about __END__ (valid, honestly, live your truth), you can disable RequireEndBeforeLastPod from your .perlcriticrc the usual way (check "CONFIGURATION" in Perl::Critic for the deets):
[-Documentation::RequireEndBeforeLastPod]
π SEE ALSO π
Perl::Critic::PulpPerl::CriticPerl::Critic::Policy::Documentation::RequirePodAtEnd
π HOME PAGE π
<http://user42.tuxfamily.org/perl-critic-pulp/index.html>
π COPYRIGHT π
Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2021 Kevin Ryde
Perl-Critic-Pulp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Perl-Critic-Pulp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Perl-Critic-Pulp. If not, see <http://www.gnu.org/licenses/>.
okay that's the whole page, love u, bye β this was perl v5.40.1, dated 2025-10-21, and yes it is still the User Contributed Perl Documentation section, mwah πβ¨
π¦ where this page comes from
- ubuntu resolute: libperl-critic-pulp-perl 100-1 Β· GPL-3.0-or-later
- ubuntu stonking: libperl-critic-pulp-perl 100-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms