1Perl::Critic::Policy::MUosoesrPee:Cr:olPn:rt:orChiribibutititecDd:E:SPPTeoRrlOliYcMDyeo:tc:huMomodeo(ns3te)a:t:iPornohibitDESTROYMethod(3)
2
3
4
6 Perl::Critic::Policy::Moose::ProhibitDESTROYMethod - Use DEMOLISH
7 instead of DESTROY
8
10 version 1.05
11
13 Getting the order of destructor execution correct with inheritance
14 involved is difficult. Let Moose take care of it for you by putting
15 your cleanup code into a "DEMOLISH()" method instead of a "DESTROY()"
16 method.
17
18 # ok
19 package Foo;
20
21 use Moose::Role;
22
23 sub DEMOLISH {
24 ...
25 }
26
27 # not ok
28 package Foo;
29
30 use Moose::Role;
31
32 sub DESTROY {
33 ...
34 }
35
37 This policy is part of Perl::Critic::Moose.
38
40 There is a single option, "equivalent_modules". This allows you to
41 specify modules that should be treated the same as Moose and
42 Moose::Role, if, say, you were doing something with Moose::Exporter.
43 For example, if you were to have this in your .perlcriticrc file:
44
45 [Moose::ProhibitDESTROYMethod]
46 equivalent_modules = MyCompany::Moose MooseX::NewThing
47
48 then the following code would result in a violation:
49
50 package Baz;
51
52 use MyCompany::Moose;
53
54 sub DESTROY {
55 ...
56 }
57
59 Moose::Manual::Construction
60
62 Bugs may be submitted through the RT bug tracker
63 <http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-Moose>
64 (or bug-perl-critic-moose@rt.cpan.org <mailto:bug-perl-critic-
65 moose@rt.cpan.org>).
66
67 I am also usually active on IRC as 'drolsky' on "irc://irc.perl.org".
68
70 • Elliot Shank <perl@galumph.com>
71
72 • Dave Rolsky <autarch@urth.org>
73
75 This software is copyright (c) 2008 - 2016 by Elliot Shank.
76
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as the Perl 5 programming language system itself.
79
80
81
82perl v5.34.0 Perl::Cri2t0i2c2:-:0P1o-l2i1cy::Moose::ProhibitDESTROYMethod(3)