Perl::...Factory(3pm)

🌸 NAME 🌸

okay so this page is Perl::...Factory(3pm) β€” your User Contributed Perl Documentation moment β€” and the actual thing it's documenting is Perl::Critic::PolicyFactory, which literally instantiates Policy objects. that's the whole job bestie πŸ’…


✨ DESCRIPTION ✨

so Perl::Critic::PolicyFactory is a helper class 🫢 its whole personality is instantiating Perl::Critic::Policy objects with your preferred parameters. that's it, that's the vibe.

and like β€” there are no user-serviceable parts here. none. zero. don't go poking around inside, it's giving "do not open, sealed for freshness" πŸ”₯


πŸŽ€ INTERFACE SUPPORT πŸŽ€

heads up bestie, this is considered to be a non-public class πŸ™ˆ its interface is subject to change without notice. so like, don't get too attached to how it looks rn, it might glow up (or glow down) at any moment. no cap.


πŸ’– CONSTRUCTOR πŸ’–

  • new( -profile => $profile, -errors => $config_errors ) β€” returns a reference to a brand new Perl::Critic::PolicyFactory object ✨
    • -profile is a reference to a Perl::Critic::UserProfile object. this argument is required β€” like, you cannot skip it, it's not optional, it's the main character πŸ‘‘
    • -errors is a reference to an instance of Perl::Critic::ConfigErrors. this argument is optional. if you do specify it, then any problems found will be added to the object 🩹

πŸ¦‹ METHODS πŸ¦‹

  • create_policy( -name => $policy_name, -params => \%param_hash ) β€” creates one Policy object. if the object cannot be instantiated, it will throw a fatal exception πŸ’€ otherwise, it returns a reference to the new Policy object. slay.
    • -name is the name of a Perl::Critic::Policy subclass module. the 'Perl::Critic::Policy' portion of the name can be omitted for brevity (iykyk, we keep it short). this argument is required ⭐
    • -params is an optional reference to hash of parameters that will be passed into the constructor of the Policy. if -params is not defined, we will use the appropriate Policy parameters from the Perl::Critic::UserProfile 🧚
note that the Policy will not have had initialize_if_enabled in Perl::Critic::Policy invoked on it, so it may not yet be usable 😭 like it exists but it's not ready-ready, y'know?
  • create_all_policies() β€” constructs and returns one instance of each Perl::Critic::Policy subclass that is installed on the local system 🌈 each Policy will be created with the appropriate parameters from the user's configuration profile. it's giving "collect the whole set" energy.
note that the Policies will not have had initialize_if_enabled in Perl::Critic::Policy invoked on them, so they may not yet be usable πŸ™ˆ same situation, they're cute but not fully loaded.

🌸 SUBROUTINES 🌸

Perl::Critic::PolicyFactory has a few static subroutines that are used internally, but may be useful to you in some way πŸ‘€ (little bonus treats, fr fr)

  • site_policy_names() β€” returns a list of all the Policy modules that are currently installed in the Perl::Critic:Policy namespace πŸŽ€ these will include modules that are distributed with Perl::Critic plus any third-party modules that have been installed. periodt.

πŸ‘‘ AUTHOR πŸ‘‘

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β€” the icon, the legend πŸ’œ


Copyright (c) 2005-2011 Imaginative Software Systems

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. the full text of this license can be found in the LICENSE file included with this module πŸ“œβœ¨


okay that's the whole page bestie, go forth and instantiate responsibly πŸ«ΆπŸ’…

perl v5.42.0 Β· 2024-10-23 Β· Perl::...Factory(3pm) β€” mwah, that's a wrap πŸŽ€πŸ’–

πŸ“¦ where this page comes from