ActiveState::PerlCritic::UserProfile - Edit a perlcriticrc file
my $profile = ActiveState::PerlCritic::UserProfile->new( $filename ); my $policy = $profile->policy("RegularExpressions::RequireExtendedFormatting"); $policy->state("enabled"); $policy->severity(2); $policy->param("foo" => 42); $profile->save( $filename );
ActiveState::PerlCritic::UserProfile objects holds a perlcriticrc file where policy state and parameters can be queried/modified and the whole configuration file written back to disk.
The following methods are provided:
Creates a new profile object and optinally initialize its state from the given filename. If a filename is passed it's also saved so that the calling the save method without a filename saves back to the same file.
Open up the user default perlcriticrc file; usually found at ~/.perlcriticrc. The file name is saved so that invoking the save method without a filename saves the state back to the file.
Write the current state of the userprofile object back to the given file. If no filename is given try to save back to the filename that the profile object was initialized from.
Returns the filename that the state was initialized from or last saved to.
Returns the name of the directory where the profile file resides.
Returns the content that would be written if the profile had been saved now.
Revert to the stored version of the configuration file.
Empty the configuration file.
Gets or sets the specified global parameter value
Lists all the policies (both configured or unconfigured).
Look up the given policy object. The returned object provide the following methods:
Returns the name of the policy; it's a string like "RegularExpressions::RequireExtendedFormatting".
Returns the name used in the configuration file. This will often be the same as
$policy->name, but not always. There should not really be a reason to expose this name to users.
Gets or sets the state of the policy. The state is one of the following values:
unconfigured enabled disabled
Gets or sets the severity for the policy. It's a number in the range 1 to 5.
Gets or sets policy specific parameter values
Copyright (C) 2010 ActiveState Software Inc. All rights reserved.