Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 wandering the Monastery: (13)
As of 2014-09-16 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (33 votes), past polls