NAME

Perl::Critic::PJCJ::Violation - a violation that carries its own fix

VERSION

version v0.3.0

SYNOPSIS

my $violation = Perl::Critic::PJCJ::Violation
  ->new($description, $explanation, $elem, $severity)
  ->set_fix({ type => "double" });

my $fix = $violation->fix;

DESCRIPTION

A subclass of Perl::Critic::Violation that lets a policy attach the structured fix data describing how to resolve the violation. The Perl::Critic::PJCJ::Fixer reads fix directly instead of looking the fix up again by the rendered description string.

The inherited constructor is used unchanged: it records the calling package as the violation's policy, so the subclass must be instantiated from within the policy package.

METHODS

set_fix ($fix)

Attach the fix structure to the violation and return the violation, so the call can be chained after new.

fix

Return the attached fix structure, or undef if none was set.

AUTHOR

Paul Johnson <paul@pjcj.net>

LICENCE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.