| 1 | package App::EvalServer::Language::Lua; | ||
| 2 | BEGIN { | ||
| 3 | $App::EvalServer::Language::Lua::AUTHORITY = 'cpan:HINRIK'; | ||
| 4 | } | ||
| 5 | BEGIN { | ||
| 6 | $App::EvalServer::Language::Lua::VERSION = '0.08'; | ||
| 7 | } | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | use Inline Lua => 'function lua_eval(str) return loadstring(str) end'; | ||
| 12 | |||
| 13 | sub evaluate { | ||
| 14 | my ($package, $code) = @_; | ||
| 15 | my $ret = lua_eval($code); | ||
| 16 | return ref $ret ? $ret->() : $ret; | ||
| 17 | } | ||
| 18 | |||
| 19 | 1; | ||
| 20 | |||
| 21 | =encoding utf8 | ||
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | App::EvalServer::Language::Lua - Evaluate Lua code | ||
| 26 | |||
| 27 | =head1 AUTHOR | ||
| 28 | |||
| 29 | Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com | ||
| 30 | |||
| 31 | =head1 LICENSE AND COPYRIGHT | ||
| 32 | |||
| 33 | Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson | ||
| 34 | |||
| 35 | This program is free software, you can redistribute it and/or modify | ||
| 36 | it under the same terms as Perl itself. | ||
| 37 | |||
| 38 | =cut |