in reply to Re: Executing code block in memory
in thread Executing code block in memory
Here's the output:
Stdout: Stderr: Result: print "hi";
Here's my test code
#!/usr/bin/perl use URI::Escape; use HTML::Entities; use Capture::Tiny qw/capture/; use CGI qw/:standard/; print "Content-type: text/html\n\n"; if(param('test')){ my $code = param('test'); $code = uri_unescape($code); $code = encode_entities($code); my($stdout, $stderr, @result) = capture { $code }; print "Stdout: $stdout\n"; print "Stderr: $stderr\n"; print "Result: @result\n"; }
Obviously what I really want to be returned here is the word: 'hi'. Maybe that clears up what I am trying to do.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Executing code block in memory
by davido (Cardinal) on Aug 08, 2012 at 21:15 UTC |