summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2007-08-16 19:16:00 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2007-08-16 19:16:00 -0500
commit4bcfa20d3a59ccd580cd1ea89666be8402e8a947 (patch)
treea3cbff0d4215ca63bfa7151036c2bceb4a593e16
parent134989a2d884020c60348738273a56aed30c725e (diff)
downloadio-pty-easy-4bcfa20d3a59ccd580cd1ea89666be8402e8a947.tar.gz
io-pty-easy-4bcfa20d3a59ccd580cd1ea89666be8402e8a947.zip
change to carp for error messages
-rw-r--r--Makefile.PL1
-rw-r--r--lib/IO/Pty/Easy.pm15
2 files changed, 9 insertions, 7 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 1cc695b..4666a37 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,6 +6,7 @@ name 'IO-Pty-Easy';
all_from 'lib/IO/Pty/Easy.pm';
requires 'IO::Pty';
+requires 'Carp';
build_requires 'Test::More';
diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm
index 6f4dd48..66b92d9 100644
--- a/lib/IO/Pty/Easy.pm
+++ b/lib/IO/Pty/Easy.pm
@@ -2,6 +2,7 @@ package IO::Pty::Easy;
use warnings;
use strict;
use IO::Pty;
+use Carp;
=head1 NAME
@@ -72,7 +73,7 @@ sub spawn {
# set up a pipe to use for keeping track of the child process during exec
my ($readp, $writep);
unless (pipe($readp, $writep)) {
- warn "Failed to create a pipe";
+ carp "Failed to create a pipe";
return;
}
$writep->autoflush(1);
@@ -92,15 +93,15 @@ sub spawn {
# pty rather than wherever they have been pointing during the script's
# execution
open(STDIN, "<&" . $slave->fileno)
- or warn "Couldn't reopen STDIN for reading";
+ or carp "Couldn't reopen STDIN for reading";
open(STDOUT, ">&" . $slave->fileno)
- or warn "Couldn't reopen STDOUT for writing";
+ or carp "Couldn't reopen STDOUT for writing";
open(STDERR, ">&" . $slave->fileno)
- or warn "Couldn't reopen STDERR for writing";
+ or carp "Couldn't reopen STDERR for writing";
close $slave;
{ exec(@_) };
print $writep $! + 0;
- die "Cannot exec(@_): $!";
+ croak "Cannot exec(@_): $!";
}
close $writep;
@@ -112,7 +113,7 @@ sub spawn {
my $errno;
my $read_bytes = sysread($readp, $errno, 256);
unless (defined $read_bytes) {
- warn "Cannot sync with child: $!";
+ carp "Cannot sync with child: $!";
kill TERM => $self->{pid};
close $readp;
return;
@@ -120,7 +121,7 @@ sub spawn {
close $readp;
if ($read_bytes > 0) {
$errno = $errno + 0;
- warn "Cannot exec(@_): $errno";
+ carp "Cannot exec(@_): $errno";
return;
}