Author image Scott E. Lee
and 1 contributors

NAME

Test::DocClaims::Line - Represent one line from a text file

SYNOPSIS

  use Test::DocClaims::Line;
  my %hash = ( text => 'package Foo;', lnum => 1 );
  $hash{file} = { path => 'foo/bar.pm', has_pod => 1 };
  $line = Test::DocClaims::Line->new(%hash);
  say $line->lnum();         # 1
  say $line->path();         # foo/bar.pm
  say $line->text();         # package Foo;

DESCRIPTION

This object represents a single line from a source file, documentation file or test suite file. It knows what file it came from and the line number in that file. It also records other attributes.

CONSTRUCTOR

new HASH

This method creates a new object from the HASH. The HASH must have as a minimum the following keys:

  file    hash of information about the file containing this line
  text    the text of the line
  lnum    the line number in the file

The hash in the "file" key must have as a minimum the following keys:

  path     path of the file
  has_pod  true if this file supports POD (*.pm vs. *.md)

If the above minimum keys are not present the method will die. Additional keys may be present in either hash.

ACCESSORS

The following accessors simply return a value from the constructor. The meaning of all such values is determined by the caller of the constructor. No logic is present to calculate or validate these values. If the requested value was not passed to the constructor then the returned value will be undef.

path

Return the path of the file.

has_pod

Return true if the file supports POD, false otherwise.

lnum

Return the line number in the file that this line came from.

text

Return the text of the line.

is_doc

Return true if this line is a line of documentation (e.g., a POD line) or false if not (e.g., code).

code

Return true if this line is from a DC_CODE section, false otherwise.

todo

Return true if this line is a "=for DC_TODO" command paragraph.

COPYRIGHT

Copyright (c) Scott E. Lee