1Perl::Critic::Policy::MUosoesre:C:oPnPrteorrhilib:bu:itCterNdietwPiMecer:tl:hPoDodol(ci3uc)mye:n:tMaotoisoen::ProhibitNewMethod(3)
2
3
4
6 Perl::Critic::Policy::Moose::ProhibitNewMethod - Don't override Moose's
7 standard constructors.
8
10 version 1.05
11
13 Overriding "new()" on a Moose class causes a number of problems,
14 including speed issues and problems with order of invocation of
15 constructors when multiple inheritance is involved. Use "BUILDARGS()"
16 and "BUILD()" instead.
17
19 This policy is part of Perl::Critic::Moose.
20
22 There is a single option, "equivalent_modules". This allows you to
23 specify modules that should be treated the same as Moose and
24 Moose::Role, if, say, you were doing something with Moose::Exporter.
25 For example, if you were to have this in your .perlcriticrc file:
26
27 [Moose::ProhibitNewMethod]
28 equivalent_modules = MyCompany::Moose MooseX::NewThing
29
30 then the following code would result in a violation:
31
32 package Baz;
33
34 use MyCompany::Moose;
35
36 sub new {
37 ...
38 }
39
41 • Moose::Manual::Construction
42
43 • Moose::Manual::BestPractices
44
46 Bugs may be submitted through the RT bug tracker
47 <http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-Moose>
48 (or bug-perl-critic-moose@rt.cpan.org <mailto:bug-perl-critic-
49 moose@rt.cpan.org>).
50
51 I am also usually active on IRC as 'drolsky' on "irc://irc.perl.org".
52
54 • Elliot Shank <perl@galumph.com>
55
56 • Dave Rolsky <autarch@urth.org>
57
59 This software is copyright (c) 2008 - 2016 by Elliot Shank.
60
61 This is free software; you can redistribute it and/or modify it under
62 the same terms as the Perl 5 programming language system itself.
63
64
65
66perl v5.36.0 Perl:2:0C2r2i-t0i7c-:2:2Policy::Moose::ProhibitNewMethod(3)