Devel:...rofile(3pm)
β¨ NAME β¨
Devel::REPL::Profile β the lil' bundle of code that runs the second re.pl wakes up π
Okay bestie, this is the Devel::REPL::Profile page, and honestly? It's giving "make your REPL do stuff for you before you even type a thing." Let's go π¦
πΈ VERSION πΈ
version 1.003029 β she's specific, she's current, she's that girl π
π SYNOPSIS π
Here's the whole vibe in one shot:
package Devel::REPL::Profile::MyProject;
use Moose;
use namespace::autoclean;
with 'Devel::REPL::Profile';
sub apply_profile {
my ($self, $repl) = @_;
# do something here
}
1;
That's it. That's the blueprint. Copy it, make it yours, slay β¨
π DESCRIPTION π
So like β picture this. You're working on a specific project, and every single time you open the REPL shell you find yourself typing the exact same commands. Loading the same Perl modules. Setting the same configuration. Over and over. Groundhog Day but make it terminal π
That's where profiles come in, and profiles are iconic. A profile is a mechanism that lets you package up and distribute all those start-up scripts as straight-up Perl modules. Ship it, share it, reuse it. Periodt. π
π USAGE π
Lowkey the whole thing is simple: just follow the "SYNOPSIS" up there and you've got yourself a boilerplate profile module. Easy.
Inside that apply_profile method, the $repl variable is your bestie β you use it to run any commands exactly the way the user would, right inside the context of their running "Devel::REPL" shell instance. Same shell, same energy π«Ά
Say you wanna load a module. That might look a lil' something like this:
sub apply_profile {
my ($self, $repl) = @_;
$repl->eval('use Carp');
}
See how we did that? The "eval" method is what you use to run any code. And here's the good part:
- the user won't see any output from it π
- the code can "safely" die without destroying the REPL shell (she survives, she's resilient πͺ)
- the return value of
"eval"will be the return value of whatever code you handed it β or, if it died, you get back a"Devel::REPL::Error"object instead
Now, if what you actually want is to load a "Devel::REPL" plugin? Different method, same dream:
$repl->load_plugin('Timing');
Honestly between "load_plugin" and "eval" you've basically got everything you'd ever want to do before the user gets their hands on the shell. And remember β plugin features are immediately available, so you can load, say, the "LexEnv" plugin and then declare "my" variables that the user will totally have access to. Main character setup behavior, no cap π
β Selecting a Profile β
Wanna run the shell with a particular profile? Easy. Just do this:
system$ re.pl --profile MyProject
Or, if that's not your vibe, you can set the environment variable "DEVEL_REPL_PROFILE" to MyProject. Same result, different route π£οΈ
And here's the naming tea π΅ β when the profile name is unqualified, like in the example right above, the profile is assumed to live in the "Devel::REPL::Profile::" namespace. But if you pass something containing the "::" character sequence, it gets loaded as-is. No assumptions, no namespace injection. Respect the full name, fr fr.
π¦ SUPPORT π¦
Got bugs? Bestie, we want them. Submit through the RT bug tracker at <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> β or if email is more your thing, hit up bug-Devel-REPL@rt.cpan.org <mailto:bug-Devel-REPL@rt.cpan.org>.
There's also an IRC channel for users of this distribution, and it lives at "#devel" on "irc.perl.org" <irc://irc.perl.org/#devel-repl>. Come hang out π¬
π AUTHOR π
Matt S Trout β mst (at) shadowcatsystems.co.uk (<http://www.shadowcatsystems.co.uk/>)
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (<http://www.shadowcatsystems.co.uk/>).
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, go wild, but respectfully π
And that's the whole page, bestie!! Sending you off with the footer tea: this is perl v5.34.0, dated 2022-06-03, from the Devel:...rofile(3pm) page. Now go write yourself a profile and make your REPL iconic πππ¦
π¦ where this page comes from
- debian bookworm: libdevel-repl-perl 1.003029-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdevel-repl-perl 1.003029-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdevel-repl-perl 1.003029-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdevel-repl-perl 1.003029-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdevel-repl-perl 1.003029-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms