1Devel::REPL::Plugin::OuUtspeurtCCaocnhter(i3b)uted PerlDDeovceulm:e:nRtEaPtLi:o:nPlugin::OutputCache(3)
2
3
4

NAME

6       Devel::REPL::Plugin::OutputCache - remember past results, _ is most
7       recent
8

SYNOPSIS

10           > 21 / 7
11           3
12           > _ * _
13           9
14           > sub { die "later" }
15           sub { die "later" }
16           > _->()
17           Runtime error: later
18

DESCRIPTION

20       Re-using results is very useful when working in a REPL. With
21       "OutputCache" you get "_", which holds the past result. The benefit is
22       that you can build up your result instead of having to type it in all
23       at once, or store it in intermediate variables. "OutputCache" also
24       provides "$_REPL->output_cache", an array reference of all results in
25       this session.
26
27       Devel::REPL already has a similar plugin, Devel::REPL::Plugin::History.
28       There are some key differences though:
29
30       Input vs Output
31           "History" remembers input. "OutputCache" remembers output.
32
33       Munging vs Pure Perl
34           "History" performs regular expressions on your input. "OutputCache"
35           provides the "_" sub as a hook to get the most recent result, and
36           "$_REPL->output_cache" for any other results.
37
38       Principle of Least Surprise
39           "History" will replace exclamation points in any part of the input.
40           This is problematic if you accidentally include one in a string, or
41           in a "not" expression. "OutputCache" uses a regular (if oddly
42           named) subroutine so Perl does the parsing -- no surprises.
43

CAVEATS

45       The "_" sub is shared across all packages. This means that if a module
46       is using the "_" sub, then there is a conflict and you should not use
47       this plugin. For example, Jifty uses the "_" sub for localization.
48       Jifty is the only known user.
49

SEE ALSO

51       "Devel::REPL", "Devel::REPL::Plugin::History"
52

AUTHOR

54       Shawn M Moore, "<sartak at gmail dot com>"
55
57       Copyright (C) 2007 by Shawn M Moore
58
59       This library is free software; you can redistribute it and/or modify it
60       under the same terms as Perl itself.
61
62
63
64perl v5.12.1                      2010-05-23Devel::REPL::Plugin::OutputCache(3)
Impressum