Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: running string as perl script and pass into STDIN programatically

by gideondsouza (Pilgrim)
on Feb 17, 2013 at 08:10 UTC ( #1019116=note: print w/ replies, xml ) Need Help??


in reply to Re: running string as perl script and pass into STDIN programatically
in thread running string as perl script and pass into STDIN programatically

So I'll just start from the use case :)

I'm developing a little pet project project here : www.tryperl.com

I'm a linux/perl beginner (touched it for the first time 3 months ago) but I want to really learn it well, so this is my learning project

My problem:
Given C (=perl code in a string) and A(=argument) I want to evaluate C and just return STDOUT and STDERR (the output of the program, or an error if it occurred). I also want to do this within a timeout.

So : my ($stdout, $err) = eval_perl($program, $args); What would be the simplest way of writing eval_perl with good performance?

I did just have a loong discussion on irc #perl and plan on building better security processes later on, but I don't know enough right now. I run the code in a EC2 vm now so I'm pretty safe. So I just want to stick to the above use case.

I also have a list of things I've tried and my issues here on stackoverflow. No answers yet :( I tried capture::tiny and also App:EvalServer I'm told executes one liners, I want to exec the whole some_script.pl program at once.


Comment on Re^2: running string as perl script and pass into STDIN programatically

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2015-07-29 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls