Add perl module perleval.
It allows you to evaluate perl code you /msg to it.
This commit is contained in:
1 parent
92304835ef
commit
080bf674e0
1 file changed
+31
@@ -0,0 +1,31 @@
|
|||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
package perleval;
|
||||||
|
use base 'ZNC::Module';
|
||||||
|
|
||||||
|
sub description {
|
||||||
|
'Evaluates perl code'
|
||||||
|
}
|
||||||
|
|
||||||
|
sub OnLoad {
|
||||||
|
my $self = shift;
|
||||||
|
if (!$self->GetUser->IsAdmin) {
|
||||||
|
$_[1] = 'Only admin can load this module';
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
sub OnModCommand {
|
||||||
|
my $self = shift;
|
||||||
|
my $cmd = shift;
|
||||||
|
my $x = eval $cmd;
|
||||||
|
if ($@) {
|
||||||
|
$self->PutModule("Error: $@")
|
||||||
|
} else {
|
||||||
|
$self->PutModule("Result: $x")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1
|
||||||
Reference in new issue
Block a user