1Perl::Critic::PolicyFacUtsoerry(C3opnmt)ributed Perl DocPuemreln:t:aCtriiotnic::PolicyFactory(3pm)
2
3
4
6 Perl::Critic::PolicyFactory - Instantiates Policy objects.
7
9 This is a helper class that instantiates Perl::Critic::Policy objects
10 with the user's preferred parameters. There are no user-serviceable
11 parts here.
12
14 This is considered to be a non-public class. Its interface is subject
15 to change without notice.
16
18 "new( -profile => $profile, -errors => $config_errors )"
19 Returns a reference to a new Perl::Critic::PolicyFactory object.
20
21 -profile is a reference to a Perl::Critic::UserProfile object.
22 This argument is required.
23
24 -errors is a reference to an instance of
25 Perl::Critic::ConfigErrors. This argument is optional. If
26 specified, than any problems found will be added to the object.
27
29 "create_policy( -name => $policy_name, -params => \%param_hash )"
30 Creates one Policy object. If the object cannot be instantiated,
31 it will throw a fatal exception. Otherwise, it returns a reference
32 to the new Policy object.
33
34 -name is the name of a Perl::Critic::Policy subclass module. The
35 'Perl::Critic::Policy' portion of the name can be omitted for
36 brevity. This argument is required.
37
38 -params is an optional reference to hash of parameters that will be
39 passed into the constructor of the Policy. If "-params" is not
40 defined, we will use the appropriate Policy parameters from the
41 Perl::Critic::UserProfile.
42
43 Note that the Policy will not have had "initialize_if_enabled" in
44 Perl::Critic::Policy invoked on it, so it may not yet be usable.
45
46 create_all_policies()
47 Constructs and returns one instance of each Perl::Critic::Policy
48 subclass that is installed on the local system. Each Policy will
49 be created with the appropriate parameters from the user's
50 configuration profile.
51
52 Note that the Policies will not have had "initialize_if_enabled" in
53 Perl::Critic::Policy invoked on them, so they may not yet be
54 usable.
55
57 Perl::Critic::PolicyFactory has a few static subroutines that are used
58 internally, but may be useful to you in some way.
59
60 site_policy_names()
61 Returns a list of all the Policy modules that are currently
62 installed in the Perl::Critic:Policy namespace. These will include
63 modules that are distributed with Perl::Critic plus any third-party
64 modules that have been installed.
65
67 Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
68
70 Copyright (c) 2005-2011 Imaginative Software Systems
71
72 This program is free software; you can redistribute it and/or modify it
73 under the same terms as Perl itself. The full text of this license can
74 be found in the LICENSE file included with this module.
75
76
77
78perl v5.38.0 2023-09-25 Perl::Critic::PolicyFactory(3pm)