is MojoX::Run really asynchronous

In looking at the SYNOPSIS example for MojoX::Run
# 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"; }
I'm wondering what is asynchronous about its usage. The reason that I say this is because of the line unless ($pid) which to me implies that line does not execute until the exit callback fires - there is no other way for $pid to be bound until then

synchronous shell usage

I like the API for MojoX::Run quite a bit. It makes the calling of shell commands succinct, handling the capture of STDERR and STDOUT, etc. Is there a similar tool on CPAN for synchronous shell usage?



The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"


In reply to synchronous shell usage; is MojoX::Run really asynchronous by metaperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.