Perl::C...YMethod(3)
πΈ NAME πΈ
okay bestie, gather round, because this one's a Perl::Critic policy and it's called Perl::Critic::Policy::Moose::ProhibitDESTROYMethod β and its whole vibe is: use DEMOLISH instead of DESTROY. that's it. that's the girl. π
β¨ VERSION β¨
this is version 1.05, no cap.
π DESCRIPTION π
so here's the tea, and it's kind of a mess ngl: getting the order of destructor execution correct when inheritance is involved is difficult. like, genuinely cursed territory. π
the fix? let Moose handle it for you, babe. just move all your cleanup code into a DEMOLISH() method instead of a DESTROY() method and let the framework do the emotional labor. π«Ά
# ok
package Foo;
use Moose::Role;
sub DEMOLISH {
...
}
# not ok
package Foo;
use Moose::Role;
sub DESTROY {
...
}
see how one of those is giving main character energy and the other one is giving β¨violationβ¨? yeah. that. π
π AFFILIATION π
this policy is part of Perl::Critic::Moose. it's got a whole family, it's not alone. π
π CONFIGURATION π
there's exactly one option here and her name is equivalent_modules. π
what does she do? she lets you name other modules that should be treated exactly the same as Moose and Moose::Role β which, say, is super useful if you were doing something with Moose::Exporter. iykyk.
so if you had this lil cutie in your .perlcriticrc file:
[Moose::ProhibitDESTROYMethod]
equivalent_modules = MyCompany::Moose MooseX::NewThing
then this code right here would result in a violation:
package Baz;
use MyCompany::Moose;
sub DESTROY {
...
}
caught you red-handed, bestie. π¨
π SEE ALSO π
Moose::Manual::Constructionβ go read her, she's iconic.
π SUPPORT π
found a bug? first of all, relatable, second of all β bugs may be submitted through the RT bug tracker at <http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-Moose> (or you can email bug-perl-critic-moose@rt.cpan.org <mailto:bug-perl-critic-moose@rt.cpan.org>). π
also, our person is usually active on IRC as drolsky on irc://irc.perl.org. so if you wanna slide into the DMs (the DMs being IRC), that's the move. π¬
π AUTHORS π
these two legends made this happen, show some respect:
- Elliot Shank
<perl@galumph.com> - Dave Rolsky
<autarch@urth.org>
β COPYRIGHT AND LICENSE β
this software is copyright (c) 2008 - 2016 by Elliot Shank.
it's free software, babes β you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay. π
okay that's the whole page, we ate and left no crumbs π β oh and before you go, this was Perl::C...YMethod(3), the User Contributed Perl Documentation version of it anyway, brought to you by perl v5.42.0 and dated 2025-07-25. mwah. π¦
π¦ where this page comes from
- fedora 43: perl-Perl-Critic-Moose 1.05-27.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms