# create async executor SINGLETON object my $mojox_run = MojoX::Run->singleton(); # simple usage my $pid = $mojox_run->spawn( cmd => "ping -W 2 -c 5 host.example.org", exit_cb => sub { my ($pid, $res) = @_; print "Ping finished with exit status $res->{exit_val}.\n"; print "\tSTDOUT:\n$res->{stdout}\n"; print "\tSTDERR:\n$res->{stderr}\n"; } ); # check for injuries unless ($pid) { print "Command startup failed: ", $mojox_run->error(), "\n"; }