Test::Reporter::Transport::File - File transport for Test::Reporter


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

Index


Code Index:

NAME

Top

Test::Reporter::Transport::File - File transport for Test::Reporter

VERSION

Top

version 1.57

SYNOPSIS

Top

    my $report = Test::Reporter->new(
        transport => 'File',
        transport_args => [ $dir ],
    );

DESCRIPTION

Top

This module saves a Test::Reporter report to the specified directory (using the write method from Test::Reporter.

This lets you save reports during offline operation. The files may later be uploaded using Test::Reporter->read().

    Test::Reporter->new->read( $file )->send();

USAGE

Top

See Test::Reporter and Test::Reporter::Transport for general usage information.

Transport Arguments

    $report->transport_args( $dir );

This transport class must have a writeable directory as its argument.

METHODS

Top

These methods are only for internal use by Test::Reporter.

new

    my $sender = Test::Reporter::Transport::File->new( $dir ); 

The new method is the object constructor.

send

    $sender->send( $report );

The send method transmits the report.

AUTHORS

Top

  Adam J. Foxson <afoxson@pobox.com>
  David Golden <dagolden@cpan.org>
  Kirrily "Skud" Robert <skud@cpan.org>
  Ricardo Signes <rjbs@cpan.org>
  Richard Soderberg <rsod@cpan.org>
  Kurt Starsinic <Kurt.Starsinic@isinet.com>

COPYRIGHT AND LICENSE

Top


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

# 
# This file is part of Test-Reporter
# 
# This software is copyright (c) 2010 by Authors and Contributors.
# 
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
# 
use strict;
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
package Test::Reporter::Transport::File;
our $VERSION = '1.57';
# ABSTRACT: File transport for Test::Reporter

use base 'Test::Reporter::Transport';

sub new {
  my ($class, $dir) = @_;

  die "target directory '$dir' doesn't exist or can't be written to"
    unless -d $dir && -w $dir;

  return bless { dir => $dir } => $class;
}

sub send {
    my ($self, $report) = @_;
    $report->dir( $self->{dir} );
    return $report->write();
}

1;




__END__