NAME
Langertha::Raider::PerlTools - MCP::Server factory with Perl evaluation, syntax check, and module install
VERSION
version 0.503
DESCRIPTION
The Perl-native tools of raider: an MCP::Server with perl_eval(code, [stdin], [timeout]), perl_check(code) and perl_cpanm(module, [options]), all run as subprocesses in the working root, with a private local::lib on PERL5LIB. perl_eval and perl_check run the perl that runs raider; the standalone binary has no usable perl of its own, so there they run the perl on PATH. Without one all three tools are a tool error there, and nothing runs.
build_perl_tools_server
my $server = Langertha::Raider::PerlTools::build_perl_tools_server(
root => '/some/dir', # working root (default: the current directory)
lib_target => '.raider/lib', # optional override
install_timeout => 300, # seconds per cpanm run (default 300)
);
Returns an MCP::Server instance with the tools perl_eval, perl_check, and perl_cpanm registered. A lib target inside the project's .raider/ (the default, .raider/lib) is created through "prepare_base" in Langertha::Raider::SessionStore, which writes .raider/.gitignore when there is none.
TOOLS
perl_eval
Evaluate Perl code with the running perl ($^X) in the working root, with the private lib on PERL5LIB, killed after timeout seconds (default 60). Returns stdout, stderr, exit_code, return_value, and (optionally) auto_installed. error is timeout when the time limit hit, otherwise the message of whatever else failed.
On "Can't locate X/Y.pm" in stderr, auto-installs the module once then retries the eval. If retry still fails, returns the error. A failed or timed-out install is noted in stderr.
In the standalone binary, which has no usable perl of its own, the code runs with the perl on PATH. Without one the call is a tool error that says so, and nothing runs.
perl_check
Compile-check Perl code via perl -c in the working root, with the private lib on PERL5LIB. This is not a sandbox: BEGIN blocks and use statements run during compilation, for at most 30 seconds. The perl is the one "perl_eval" uses. Returns valid (bool) and syntax_error (string or null).
perl_cpanm
Install a CPAN module into a private local::lib. An explicit options.target must lie inside the working root (relative paths resolve against it); anything else is rejected. Creates the target directory (with cpanfile + perl-version marker) on first install. The marker holds $] of the perl the lib is for, the one "perl_eval" uses; in the standalone binary that perl is asked for it. The cpanfile is updated idempotently (no duplicate entries). In the standalone binary without a perl on PATH the call is a tool error, as for "perl_eval", and cpanm does not run. error is timeout when cpanm hit the install_timeout limit, otherwise the message of whatever else kept it from running.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-raider/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.