ActiveState::PerlCritic::UserProfile(3)

NAME
ActiveState::PerlCritic::UserProfile - Edit a perlcriticrc file

SYNOPSIS
  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 );

DESCRIPTION
"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:

$profile = ActiveState::PerlCritic::UserProfile->new
$profile = ActiveState::PerlCritic::UserProfile->new( $filename )
    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.

$profile = ActiveState::PerlCritic::UserProfile->new_default
    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.

$profile->save
$profile->save( $filename )
    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.

$profile->filename
    Returns the filename that the state was initialized from or last saved to.

$profile->dirname
    Returns the name of the directory where the profile file resides.

$profile->content
    Returns the content that would be written if the profile had been saved now.

$profile->revert
    Revert to the stored version of the configuration file.

$profile->clear
    Empty the configuration file.

$profile->param( $name )
$profile->param( $name => $new_svalue )
    Gets or sets the specified global parameter value

$profile->policies
    Lists all the policies (both configured or unconfigured).

$profile->policy( $name )
    Look up the given policy object. The returned object provide the following methods:

    $policy->name
        Returns the name of the policy; it's a string like "RegularExpressions::RequireExtendedFormatting".

    $policy->config_name
        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.

    $policy->state
    $policy->state( $new_state )
        Gets or sets the state of the policy. The state is one of the following values:

          unconfigured
          enabled
          disabled

    $policy->severity
    $policy->severity( $int )
        Gets or sets the severity for the policy. It's a number in the range 1 to 5.

    $policy->param( $name )
    $policy->param( $name => $new_value )
        Gets or sets policy specific parameter values

SEE ALSO
Perl::Critic, ActiveState::Config::INI

COPYRIGHT
Copyright (C) 2010 ActiveState Software Inc. All rights reserved.