Test::Valgrind::Report - Base class for Test::Valgrind error reports.


Test-Valgrind documentation Contained in the Test-Valgrind distribution.

Index


Code Index:

NAME

Top

Test::Valgrind::Report - Base class for Test::Valgrind error reports.

VERSION

Top

Version 1.12

DESCRIPTION

Top

This class provides a generic API for messages (the so-called reports) generated by the parser, filtered by the tool and the command, and handled by the action. The tool has authority for deciding in which subclass of this one reports should be blessed.

Reports are classified by kinds. The Diag kind is reserved for diagnostics.

new kind => $kind, id => $id, data => $data

Your usual constructor.

All options are mandatory :

new_diag $data

Constructs a report with kind 'Diag', an auto-incremented identifier and the given $data.

kind

Read-only accessor for the kind option.

id

Read-only accessor for the id option.

data

Read-only accessor for the data option.

is_diag

Tells if a report has the 'Diag' kind, i.e. is a diagnostic.

kinds

Returns the list of valid kinds for this report class.

Defaults to 'Diag'.

valid_kind $kind

Tells whether $kind is a valid kind for this report class.

Defaults to true iff $kind eq 'Diag'.

SEE ALSO

Top

Test::Valgrind.

AUTHOR

Top

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on irc.perl.org (vincent).

BUGS

Top

Please report any bugs or feature requests to bug-test-valgrind at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Test::Valgrind::Report

COPYRIGHT & LICENSE

Top


Test-Valgrind documentation Contained in the Test-Valgrind distribution.
package Test::Valgrind::Report;

use strict;
use warnings;

our $VERSION = '1.12';

use base qw/Test::Valgrind::Carp/;

sub new {
 my $class = shift;
 $class = ref($class) || $class;

 my %args = @_;

 my $kind = delete $args{kind};
 $class->_croak("Invalid kind $kind for $class")
                                               unless $class->valid_kind($kind);

 my $id = delete $args{id};
 $class->_croak("Invalid identifier $id") unless defined $id and not ref $id;

 my $data = delete $args{data};

 bless {
  kind => $kind,
  id   => $id,
  data => $data,
 }, $class;
}

my $diag_id = 0;

sub new_diag { shift->new(kind => 'Diag', id => ++$diag_id, data => $_[0]) }

sub kind { $_[0]->{kind} }

sub id { $_[0]->{id} }

sub data { $_[0]->{data} }

sub is_diag { $_[0]->kind eq 'Diag' }

sub kinds { 'Diag' }

sub valid_kind { $_[1] eq 'Diag' }

1; # End of Test::Valgrind::Report