1Devel::REPL::Plugin::FaUnsceyrPrCoomnpttr(i3b)uted PerlDDeovceulm:e:nRtEaPtLi:o:nPlugin::FancyPrompt(3)
2
3
4
6 Devel::REPL::Plugin::FancyPrompt - Facilitate user-defined prompts
7
9 version 1.003028
10
12 use Devel::REPL;
13
14 my $repl = Devel::REPL->new;
15 $repl->load_plugin('MultiLine::PPI'); # for indent depth
16 $repl->load_plugin('Packages'); # for current package
17 $repl->load_plugin('FancyPrompt');
18 $repl->run;
19
21 FancyPrompt helps you write your own prompts. The default fancy prompt
22 resembles "irb"'s default prompt. The default "fancy_prompt" looks like
23 this:
24
25 re.pl(main):001:0> 2 + 2
26 4
27
28 "re.pl" is a constant. "main" is the current package. The first number
29 is how many lines have been read so far. The second number (only if you
30 have a "MultiLine" plugin) is how deep you are; intuitively, your
31 indent level. This default can be implemented with:
32
33 $_REPL->fancy_prompt(sub {
34 my $self = shift;
35 sprintf 're.pl(%s):%03d%s> ',
36 $self->can('current_package') ? $self->current_package : 'main',
37 $self->lines_read,
38 $self->can('line_depth') ? ':' . $self->line_depth : '';
39 });
40
41 "current_package" is provided by Devel::REPL::Plugin::Packages (which
42 tracks the current package). "line_depth" is provided by a "MultiLine"
43 plugin (probably "MultiLine::PPI").
44
45 You may also set a "fancy_continuation_prompt". The default is very
46 similar to "fancy_prompt"'s default (except "*" instead of ">").
47
49 "Devel::REPL"
50
52 Bugs may be submitted through the RT bug tracker
53 <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> (or
54 bug-Devel-REPL@rt.cpan.org <mailto:bug-Devel-REPL@rt.cpan.org>).
55
56 There is also an irc channel available for users of this distribution,
57 at "#devel" on "irc.perl.org" <irc://irc.perl.org/#devel-repl>.
58
60 Shawn M Moore, "<sartak at gmail dot com>"
61
63 Copyright (C) 2007 by Shawn M Moore
64
65 This library is free software; you can redistribute it and/or modify it
66 under the same terms as Perl itself.
67
68
69
70perl v5.34.0 2021-07-22Devel::REPL::Plugin::FancyPrompt(3)