NAME

Perl::Critic::Utils::SourceLocation - Synthetic PPI element

VERSION

version v0.1.2

SYNOPSIS

# Used internally by ProhibitLongLines policy
my $location = SourceLocation->new(
  line_number => 42,
  content     => "long line content"
);

DESCRIPTION

This is a synthetic PPI element used by ProhibitLongLines policy to provide accurate line number reporting when no real PPI token exists on a line (such as within POD blocks).

METHODS

new

my $location = Perl::Critic::Utils::SourceLocation->new(
  line_number   => 42,
  column_number => 1,
  content       => "line content",
  filename      => "file.pl"
);

Creates a new SourceLocation object. Parameters:

  • line_number (required) - The line number in the source file

  • column_number (optional) - The column number, defaults to 1

  • content (optional) - The content of the line, defaults to empty string

  • filename (optional) - The filename, can be undef

is_policy

my $is_policy = $location->is_policy;  # Always returns 0

Returns false to indicate this is not a Perl::Critic policy.

filename

my $filename = $location->filename;

Returns the filename associated with this location, or undef if none was set.

AUTHOR

Paul Johnson <paul@pjcj.net>

COPYRIGHT

Copyright 2025 Paul Johnson.

LICENCE

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