Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another pull request #2

Merged
merged 2 commits into from
Oct 2, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/AnyEvent/Open3/Simple.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use warnings;
use v5.10; use v5.10;
use AnyEvent; use AnyEvent;
use IPC::Open3 qw( open3 ); use IPC::Open3 qw( open3 );
use Scalar::Util qw( reftype );
use Symbol qw( gensym ); use Symbol qw( gensym );
use AnyEvent::Open3::Simple::Process; use AnyEvent::Open3::Simple::Process;


Expand Down Expand Up @@ -109,7 +110,7 @@ sub new
{ {
state $default_handler = sub { }; state $default_handler = sub { };
my $class = shift; my $class = shift;
my $args = ref $_[0] eq 'HSAH' ? shift : { @_ }; my $args = reftype($_[0]) eq 'HASH' ? shift : { @_ };
my %self; my %self;
$self{$_} = $args->{$_} // $default_handler for qw( on_stdout on_stderr on_start on_exit on_signal on_fail on_error ); $self{$_} = $args->{$_} // $default_handler for qw( on_stdout on_stderr on_start on_exit on_signal on_fail on_error );
bless \%self, $class; bless \%self, $class;
Expand Down