Created
April 7, 2012 04:14
-
-
Save kraih/2324993 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojolicious::Lite; | |
use EV; | |
use AnyEvent; | |
use AnyEvent::Util; | |
get '/' => sub { | |
my $self = shift; | |
# Run Perl oneliner in separate process and capture STDOUT | |
fork_call { | |
open my $fh, '-|', qq/perl -E'say "hi!"'/ or die "Oneliner: $!"; | |
local $/; | |
return <$fh>; | |
} | |
sub { | |
my $result = shift; | |
$self->render(text => "Result: $result"); | |
}; | |
}; | |
app->start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment