.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Devel::REPL 3pm" .TH Devel::REPL 3pm "2016-02-16" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Devel::REPL \- A modern perl interactive shell .SH "VERSION" .IX Header "VERSION" version 1.003028 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& my $repl = Devel::REPL\->new; \& $repl\->load_plugin($_) for qw(History LexEnv); \& $repl\->run .Ve .PP Alternatively, use the 're.pl' script installed with the distribution .PP .Vb 1 \& system$ re.pl .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is an interactive shell for Perl, commonly known as a \s-1REPL \-\s0 Read, Evaluate, Print, Loop. The shell provides for rapid development or testing of code without the need to create a temporary source code file. .PP Through a plugin system, many features are available on demand. You can also tailor the environment through the use of profiles and run control files, for example to pre-load certain Perl modules when working on a particular project. .SH "USAGE" .IX Header "USAGE" To start a shell, follow one of the examples in the \*(L"\s-1SYNOPSIS\*(R"\s0 above. .PP Once running, the shell accepts and will attempt to execute any code given. If the code executes successfully you'll be shown the result, otherwise an error message will be returned. Here are a few examples: .PP .Vb 5 \& $_ print "Hello, world!\en" \& Hello, world! \& 1 \& $_ nosuchfunction \& Compile error: Bareword "nosuchfunction" not allowed while "strict subs" in use at (eval 130) line 5. \& \& $_ .Ve .PP In the first example above you see the output of the command (\f(CW\*(C`Hello, world!\*(C'\fR), if any, and then the return value of the statement (\f(CW1\fR). Following that example, an error is returned when the execution of some code fails. .PP Note that the lack of semicolon on the end is not a mistake \- the code is run inside a Block structure (to protect the \s-1REPL\s0 in case the code blows up), which means a single statement doesn't require the semicolon. You can add one if you like, though. .PP If you followed the first example in the \*(L"\s-1SYNOPSIS\*(R"\s0 above, you'll have the History and LexEnv plugins loaded (and there are many more available). Although the shell might support \*(L"up-arrow\*(R" history, the History plugin adds \&\*(L"bang\*(R" history to that so you can re-execute chosen commands (with e.g. \&\f(CW\*(C`!53\*(C'\fR). The LexEnv plugin ensures that lexical variables declared with the \&\f(CW\*(C`my\*(C'\fR keyword will automatically persist between statements executed in the \&\s-1REPL\s0 shell. .PP When you \f(CW\*(C`use\*(C'\fR any Perl module, the \f(CW\*(C`import()\*(C'\fR will work as expected \- the exported functions from that module are available for immediate use: .PP .Vb 5 \& $_ carp "I\*(Aqm dieeeing!\en" \& String found where operator expected at (eval 129) line 5, near "carp "I\*(Aqm dieeeing!\en"" \& (Do you need to predeclare carp?) \& Compile error: syntax error at (eval 129) line 5, near "carp "I\*(Aqm dieeeing!\en"" \& BEGIN not safe after errors\-\-compilation aborted at (eval 129) line 5. \& \& $_ use Carp \& \& $_ carp "I\*(Aqm dieeeing!\en" \& I\*(Aqm dieeeing! \& at /usr/share/perl5/Lexical/Persistence.pm line 327 \& 1 \& $_ .Ve .PP To quit from the shell, hit \f(CW\*(C`Ctrl+D\*(C'\fR or \f(CW\*(C`Ctrl+C\*(C'\fR. .PP .Vb 2 \& MSWin32 NOTE: control keys won\*(Aqt work if TERM=dumb \& because readline functionality will be disabled. .Ve .SS "Run Control Files" .IX Subsection "Run Control Files" For particular projects you might well end up running the same commands each time the \s-1REPL\s0 shell starts up \- loading Perl modules, setting configuration, and so on. A run control file lets you have this done automatically, and you can have multiple files for different projects. .PP By default the \f(CW\*(C`re.pl\*(C'\fR program looks for \f(CW\*(C`$HOME/.re.pl/repl.rc\*(C'\fR, and runs whatever code is in there as if you had entered it at the \s-1REPL\s0 shell yourself. .PP To set a new run control file that's also in that directory, pass it as a filename like so: .PP .Vb 1 \& system$ re.pl \-\-rcfile myproject.pc .Ve .PP If the filename happens to contain a forward slash, then it's used absolutely, or realive to the current working directory: .PP .Vb 1 \& system$ re.pl \-\-rcfile /path/to/my/project/repl.rc .Ve .PP Within the run control file you might want to load plugins. This is covered in \&\*(L"The \s-1REPL\s0 shell object\*(R" section, below. .SS "Profiles" .IX Subsection "Profiles" To allow for the sharing of run control files, you can fashion them into a Perl module for distribution (perhaps via the \s-1CPAN\s0). For more information on this feature, please see the Devel::REPL::Profile manual page. .PP A \f(CW\*(C`Standard\*(C'\fR profile ships with \f(CW\*(C`Devel::REPL\*(C'\fR; it loads the following plugins (note that some of these require optional features \*(-- or you can also use the \&\f(CW\*(C`Minimal\*(C'\fR profile): .IP "\(bu" 4 Devel::REPL::Plugin::History .IP "\(bu" 4 Devel::REPL::Plugin::LexEnv .IP "\(bu" 4 Devel::REPL::Plugin::DDS .IP "\(bu" 4 Devel::REPL::Plugin::Packages .IP "\(bu" 4 Devel::REPL::Plugin::Commands .IP "\(bu" 4 Devel::REPL::Plugin::MultiLine::PPI .IP "\(bu" 4 Devel::REPL::Plugin::Colors .IP "\(bu" 4 Devel::REPL::Plugin::Completion .IP "\(bu" 4 Devel::REPL::Plugin::CompletionDriver::INC .IP "\(bu" 4 Devel::REPL::Plugin::CompletionDriver::LexEnv .IP "\(bu" 4 Devel::REPL::Plugin::CompletionDriver::Keywords .IP "\(bu" 4 Devel::REPL::Plugin::CompletionDriver::Methods .IP "\(bu" 4 Devel::REPL::Plugin::ReadlineHistory .SS "Plugins" .IX Subsection "Plugins" Plugins are a way to add functionality to the \s-1REPL\s0 shell, and take advantage of \&\f(CW\*(C`Devel::REPL\*(C'\fR being based on the Moose object system for Perl 5. This means it's simple to 'hook into' many steps of the R\-E-P-L process. Plugins can change the way commands are interpreted, or the way their results are output, or even add commands to the shell environment. .PP A number of plugins ship with \f(CW\*(C`Devel::REPL\*(C'\fR, and more are available on the \&\s-1CPAN.\s0 Some of the shipped plugins are loaded in the default profile, mentioned above. These plugins can be loaded in your \fI \f(CI$HOME\fI/.re.pl/repl.rc \fR like: .PP .Vb 1 \& load_plugin qw( CompletionDriver::Global DumpHistory ); .Ve .PP Writing your own plugins is not difficult, and is discussed in the Devel::REPL::Plugin manual page, along with links to the manual pages of all the plugins shipped with \f(CW\*(C`Devel::REPL\*(C'\fR. .SS "The \s-1REPL\s0 shell object" .IX Subsection "The REPL shell object" From time to time you'll want to interact with or manipulate the \&\f(CW\*(C`Devel::REPL\*(C'\fR shell object itself; that is, the instance of the shell you're currently running. .PP The object is always available through the \f(CW$_REPL\fR variable. One common requirement is to load an additional plugin, after your profile and run control files have already been executed: .PP .Vb 7 \& $_ $_REPL\->load_plugin(\*(AqTiming\*(Aq); \& 1 \& $_ print "Hello again, world!\en" \& Hello again, world! \& Took 0.00148296356201172 seconds. \& 1 \& $_ .Ve .SH "OPTIONAL FEATURES" .IX Header "OPTIONAL FEATURES" In addition to the prerequisites declared in this distribution, which should be automatically installed by your \s-1CPAN\s0 client, there are a number of optional features, used by additional plugins. You can install any of these features by installing this distribution interactively (e.g. \f(CW\*(C`cpanm \-\-interactive Devel::REPL\*(C'\fR). .IP "\(bu" 4 Completion plugin \- extensible tab completion .IP "\(bu" 4 \&\s-1DDS\s0 plugin \- better format results with Data::Dump::Streamer .IP "\(bu" 4 \&\s-1DDC\s0 plugin \- even better format results with Data::Dumper::Concise .IP "\(bu" 4 \&\s-1INC\s0 completion driver \- tab complete module names in use and require .IP "\(bu" 4 Interrupt plugin \- traps \s-1SIGINT\s0 to kill long-running lines .IP "\(bu" 4 Keywords completion driver \- tab complete Perl keywords and operators .IP "\(bu" 4 LexEnv plugin \- variables declared with \*(L"my\*(R" persist between statements .IP "\(bu" 4 MultiLine::PPI plugin \- continue reading lines until all blocks are closed .IP "\(bu" 4 Nopaste plugin \- upload a session\e's input and output to a Pastebin .IP "\(bu" 4 \&\s-1PPI\s0 plugin \- \s-1PPI\s0 dumping of Perl code .IP "\(bu" 4 Refresh plugin \- automatically reload libraries with Module::Refresh .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 A comparison of various REPLs .SH "SUPPORT" .IX Header "SUPPORT" Bugs may be submitted through the \s-1RT\s0 bug tracker (or bug\-Devel\-REPL@rt.cpan.org ). .PP There is also an irc channel available for users of this distribution, at \&\f(CW\*(C`#devel\*(C'\fR on \f(CW\*(C`irc.perl.org\*(C'\fR . .SH "AUTHOR" .IX Header "AUTHOR" Matt S Trout \- mst (at) shadowcatsystems.co.uk () .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Karen Etheridge .IP "\(bu" 4 Shawn M Moore .IP "\(bu" 4 Chris Marshall .IP "\(bu" 4 Matt S Trout .IP "\(bu" 4 Oliver Gorwits .IP "\(bu" 4 יובל קוג'מן (Yuval Kogman) .IP "\(bu" 4 Arthur Axel 'fREW' Schmidt .IP "\(bu" 4 Andrew Moore .IP "\(bu" 4 Alexis Sukrieh .IP "\(bu" 4 Tomas Doran (t0m) .IP "\(bu" 4 epitaph .IP "\(bu" 4 Norbert Buchmuller .IP "\(bu" 4 Jesse Luehrs .IP "\(bu" 4 Dave Houston .IP "\(bu" 4 Dagfinn Ilmari Mannsåker .IP "\(bu" 4 Zakariyya Mughal .IP "\(bu" 4 Ryan Niebur .IP "\(bu" 4 Justin Hunter .IP "\(bu" 4 Ash Berlin .IP "\(bu" 4 naquad .IP "\(bu" 4 Stevan Little .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" This software is copyright (c) 2007 by Matt S Trout \- mst (at) shadowcatsystems.co.uk (). .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.