Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Created September 30, 2011 13:52
Show Gist options
  • Save kentfredric/1253798 to your computer and use it in GitHub Desktop.
Save kentfredric/1253798 to your computer and use it in GitHub Desktop.
alias 'peval'="perl -E '
use 5.14.2;
my \$code = shift(@ARGV);
use strict;
use warnings FATAL => q[all];
use Carp::Always;
use Try::Tiny;
use Data::Dump qw( dump );
local \$@;
my \$realcode = qq[
# line 1 \"(evaler)\"
use 5.14.2;
use strict;
use warnings FATAL => q[all];
use Try::Tiny;
use Data::Dump qw( dump );
try {
say dump(do {
# line 1 \"(userinput)\"
\$code
})
} catch {
*STDERR->print(qq[\\\$_])
};
];
# print \$realcode;
eval \$realcode;
if( \$@ ){
*STDERR->print(qq[\$@])
}
'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment