Author image Scott E. Lee
and 1 contributors


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


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


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.


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.


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.


Return the path of the file.


Return true if the file supports POD, false otherwise.


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


Return the text of the line.


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


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


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


Copyright (c) Scott E. Lee