PITA::XML::Command - An executed command, with stored output


PITA-XML documentation Contained in the PITA-XML distribution.

Index


Code Index:

NAME

Top

PITA::XML::Command - An executed command, with stored output

SYNOPSIS

Top

  # Create a command
  my $dist = PITA::XML::Request->new(
  	cmd    => 'perl Makefile.PL',
  	stdout => \"...",
  	stderr => \"...",
  	);

DESCRIPTION

Top

PITA::XML::Command is an object for holding information about a command executed during the installation process.

It holds the actual command, and the STDOUT and STDERR output.

METHODS

Top

new

The new constructor is used to create a new ::Command object.

It takes a set of key/value names params.

cmd

The cmd param should contains the command that was executed, as it was sent to the operating system, as as a plain string.

stdout

The stdout param should be the resulting output to STDOUT, provided as a reference to a SCALAR string.

stderr

The stderr param should be the resulting output to STDERR, provided as a reference to a SCALAR string.

Returns a new PITA::XML::Command object, or dies on error.

cmd

The cmd accessor returns the actual command sent to the system.

stdout

The stdout accessor returns the output of the command as a SCALAR reference.

stderr

The stderr accessor returns the output of the command as a SCALAR reference.

SUPPORT

Top

Bugs should be reported via the CPAN bug tracker at

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PITA-XML

For other issues, contact the author.

AUTHOR

Top

Adam Kennedy <adamk@cpan.org>, http://ali.as/

SEE ALSO

Top

PITA::XML

The Perl Image-based Testing Architecture (http://ali.as/pita/)

COPYRIGHT

Top


PITA-XML documentation Contained in the PITA-XML distribution.
package PITA::XML::Command;

use 5.006;
use strict;
use Carp         ();
use Params::Util qw{ _SCALAR0 _STRING };

use vars qw{$VERSION};
BEGIN {
	$VERSION = '0.51';
}





#####################################################################
# Constructors and Accessors

sub new {
	my $class = shift;
	my $self  = bless { @_ }, $class;

	# Check the object
	$self->_init;

	$self;
}

sub _init {
	my $self = shift;

	# Check the actual command string
	unless ( _STRING($self->{cmd}) ) {
		Carp::croak('Invalid or missing cmd');
	}

	# Check the STDOUT
	unless ( PITA::XML->_OUTPUT($self, 'stdout') ) {
		Carp::croak('Invalid or missing stdout');
	}

	# Check the STDERR
	unless ( PITA::XML->_OUTPUT($self, 'stderr') ) {
		Carp::croak('Invalid or missing stderr');
	}

	$self;
}

sub cmd {
	$_[0]->{cmd};
}

sub stdout {
	$_[0]->{stdout};
}

sub stderr {
	$_[0]->{stderr};
}

1;