File Coverage

blib/lib/App/EvalServer/Language/Perl.pm
Criterion Covered Total %
statement 8 16 50.0
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 12 24 50.0


line stmt bran cond sub pod time code
1             package App::EvalServer::Language::Perl;
2             BEGIN {
3 1     1   3746 $App::EvalServer::Language::Perl::AUTHORITY = 'cpan:HINRIK';
4             }
5             BEGIN {
6 1     1   24 $App::EvalServer::Language::Perl::VERSION = '0.08';
7             }
8              
9 1     1   10 use strict;
  1         2  
  1         86  
10 1     1   8 use warnings;
  1         2  
  1         307  
11              
12             # TODO: attempt to load the utf8/unicode libraries.
13             #use utf8;
14             #use charnames qw(:full);
15             #BEGIN {
16             # eval "\$\343\201\257 = 42";
17             # uc "\x{666}";
18             #}
19              
20             sub evaluate {
21 0     0 0   my ($package, $code) = @_;
22              
23 0           local $@ = undef;
24 0           local @INC = undef;
25 0           local $_ = undef;
26              
27 0           $code = "no strict; no warnings; package main; $code";
28 0           my $ret = eval $code;
29              
30 0 0         print STDERR $@ if length($@);
31 0           return $ret;
32             }
33              
34             1;
35              
36             =encoding utf8
37              
38             =head1 NAME
39              
40             App::EvalServer::Language::Perl - Evaluate Perl code
41              
42             =head1 AUTHOR
43              
44             Hinrik Ern SigurEsson, hinrik.sig@gmail.com
45              
46             =head1 LICENSE AND COPYRIGHT
47              
48             Copyright 2010 Hinrik Ern SigurEsson
49              
50             This program is free software, you can redistribute it and/or modify
51             it under the same terms as Perl itself.
52              
53             =cut