my $self = shift;
$_ = $self->{output};
/\|(.*)$/;
return $1 || "";
}
sub only_output {
my $self = shift;
$_ = $self->{output};
/(.*?)\|/;
return $1 || "";
}
sub testCmd {
my $class = shift;
my $command = shift or die "No command passed to testCmd";
my $object = $class->new;
my $output = `$command`;
$object->return_code($? >> 8);
$_ = $? & 127;
if ($_) {
die "Got signal $_ for command $command";
}
chomp $output;
$object->output($output);
if ($ENV{'NPTEST_DEBUG'}) {
my ($pkg, $file, $line) = caller(0);
print "testCmd: Called from line $line in $file", $/;
print "Testing: $command", $/;
print "Output: ", $object->output, $/;
print "Return code: ", $object->return_code, $/;
}
return $object;
}
1;
#
# End of File
#
=7=
THE END |