in reply to Re^2: Executing code block in memory
in thread Executing code block in memory
#!/usr/bin/perl -w use strict; use URI::Escape; use HTML::Entities; use CGI qw/:standard/; use CGI::Carp 'fatalsToBrowser'; print header; my $file; if(param('test')){ my $code = param('test'); $code = uri_unescape($code); $code = encode_entities($code); open STDERR, '>&STDOUT'; eval $code; print $@ if $@; }
No need to create external, temporary files. There are some potential messy issues in there, but this is good enough for rough cut.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|