Vulnerabilities | |||||
---|---|---|---|---|---|
Version | Suggest | Low | Medium | High | Critical |
1.003029 | 0 | 0 | 0 | 0 | 0 |
1.003028 | 0 | 0 | 0 | 0 | 0 |
1.003027 | 0 | 0 | 0 | 0 | 0 |
1.003026 | 0 | 0 | 0 | 0 | 0 |
1.003025 | 0 | 0 | 0 | 0 | 0 |
1.003024 | 0 | 0 | 0 | 0 | 0 |
1.003023 | 0 | 0 | 0 | 0 | 0 |
1.003022 | 0 | 0 | 0 | 0 | 0 |
1.003021 | 0 | 0 | 0 | 0 | 0 |
1.003020 | 0 | 0 | 0 | 0 | 0 |
1.003019 | 0 | 0 | 0 | 0 | 0 |
1.003018 | 0 | 0 | 0 | 0 | 0 |
1.003017 | 0 | 0 | 0 | 0 | 0 |
1.003016 | 0 | 0 | 0 | 0 | 0 |
1.003015 | 0 | 0 | 0 | 0 | 0 |
1.003014 | 0 | 0 | 0 | 0 | 0 |
1.003029 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
Artistic-1.0 - Artistic License 1.0=pod
=encoding UTF-8
=head1 NAME
Devel::REPL - A modern perl interactive shell
=head1 VERSION
version 1.003027
=head1 SYNOPSIS
my $repl = Devel::REPL->new; $repl->load_plugin($_) for qw(History LexEnv); $repl->run
Alternatively, use the 're.pl' script installed with the distribution
system$ re.pl
=head1 DESCRIPTION
This is an interactive shell for Perl, commonly known as a REPL - Read, Evaluate, Print, Loop. The shell provides for rapid development or testing of code without the need to create a temporary source code file.
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.
=head1 USAGE
To start a shell, follow one of the examples in the L</"SYNOPSIS"> above.
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:
$_ print "Hello, world!\n" Hello, world! 1 $_ nosuchfunction Compile error: Bareword "nosuchfunction" not allowed while "strict subs" in use at (eval 130) line 5.
$_
In the first example above you see the output of the command (C<Hello, world!>), if any, and then the return value of the statement (C<1>). Following that example, an error is returned when the execution of some code fails.
Note that the lack of semicolon on the end is not a mistake - the code is run inside a Block structure (to protect the REPL in case the code blows up), which means a single statement doesn't require the semicolon. You can add one if you like, though.
If you followed the first example in the L</"SYNOPSIS"> above, you'll have the L<History|Devel::REPL::Plugin::History> and L<LexEnv|Devel::REPL::Plugin::LexEnv> plugins loaded (and there are many more available). Although the shell might support "up-arrow" history, the History plugin adds "bang" history to that so you can re-execute chosen commands (with e.g. C<!53>). The LexEnv plugin ensures that lexical variables declared with the C keyword will automatically persist between statements executed in the REPL shell.
When you C any Perl module, the C<import()> will work as expected - the exported functions from that module are available for immediate use:
$_ carp "I'm dieeeing!\n" String found where operator expected at (eval 129) line 5, near "carp "I'm dieeeing!\n"" (Do you need to predeclare carp?) Compile error: syntax error at (eval 129) line 5, near "carp "I'm dieeeing!\n"" BEGIN not safe after errors--compilation aborted at (eval 129) line 5.
$_ use Carp
$_ carp "I'm dieeeing!\n" I'm dieeeing! at /usr/share/perl5/Lexical/Persistence.pm line 327 1 $_
To quit from the shell, hit C<Ctrl+D> or C<Ctrl+C>.
MSWin32 NOTE: control keys won't work if TERM=dumb because readline functionality will be disabled.
=head2 Run Control Files
For particular projects you might well end up running the same commands each time the REPL 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.
By default the C<re.pl> program looks for C<< $HOME/.re.pl/repl.rc >>, and runs whatever code is in there as if you had entered it at the REPL shell yourself.
To set a new run control file that's also in that directory, pass it as a filename like so:
system$ re.pl --rcfile myproject.pc
If the filename happens to contain a forward slash, then it's used absolutely, or realive to the current working directory:
system$ re.pl --rcfile /path/to/my/project/repl.rc
Within the run control file you might want to load plugins. This is covered in L</"The REPL shell object"> section, below.
=head2 Profiles
To allow for the sharing of run control files, you can fashion them into a Perl module for distribution (perhaps via the CPAN). For more information on this feature, please see the LDevel::REPL::Profile manual page.
A C profile ships with CDevel::REPL; it loads the following plugins (note that some of these require optional features -- or you can also use the C profile):
=over 4
=item *
LDevel::REPL::Plugin::History
=item *
LDevel::REPL::Plugin::LexEnv
=item *
LDevel::REPL::Plugin::DDS
=item *
LDevel::REPL::Plugin::Packages
=item *
LDevel::REPL::Plugin::Commands
=item *
LDevel::REPL::Plugin::MultiLine::PPI
=item *
LDevel::REPL::Plugin::Colors
=item *
LDevel::REPL::Plugin::Completion
=item *
LDevel::REPL::Plugin::CompletionDriver::INC
=item *
LDevel::REPL::Plugin::CompletionDriver::LexEnv
=item *
LDevel::REPL::Plugin::CompletionDriver::Keywords
=item *
LDevel::REPL::Plugin::CompletionDriver::Methods
=item *
LDevel::REPL::Plugin::ReadlineHistory
=back
=head2 Plugins
Plugins are a way to add functionality to the REPL shell, and take advantage of CDevel::REPL being based on the L 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.
A number of plugins ship with CDevel::REPL, and more are available on the CPAN. Some of the shipped plugins are loaded in the default profile, mentioned above. These plugins can be loaded in your F< $HOME/.re.pl/repl.rc > like:
load_plugin qw( CompletionDriver::Global DumpHistory );
Writing your own plugins is not difficult, and is discussed in the LDevel::REPL::Plugin manual page, along with links to the manual pages of all the plugins shipped with CDevel::REPL.
=head2 The REPL shell object
From time to time you'll want to interact with or manipulate the CDevel::REPL shell object itself; that is, the instance of the shell you're currently running.
The object is always available through the C<$_REPL> variable. One common requirement is to load an additional plugin, after your profile and run control files have already been executed:
$_ $REPL->load_plugin('Timing'); 1 $ print "Hello again, world!\n" Hello again, world! Took 0.00148296356201172 seconds. 1 $_
=head1 OPTIONAL FEATURES
In addition to the prerequisites declared in this distribution, which should be automatically installed by your L 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. C<cpanm --interactive Devel::REPL>).
=for comment I hope to automatically generate this data via a Pod::Weaver section
=over 4
=item *
Completion plugin - extensible tab completion
=item *
DDS plugin - better format results with Data::Dump::Streamer
=item *
DDC plugin - even better format results with Data::Dumper::Concise
=item *
INC completion driver - tab complete module names in use and require
=item *
Interrupt plugin - traps SIGINT to kill long-running lines
=item *
Keywords completion driver - tab complete Perl keywords and operators
=item *
LexEnv plugin - variables declared with "my" persist between statements
=item *
MultiLine::PPI plugin - continue reading lines until all blocks are closed
=item *
Nopaste plugin - upload a session's input and output to a Pastebin
=item *
PPI plugin - PPI dumping of Perl code
=item *
Refresh plugin - automatically reload libraries with Module::Refresh
=back
=head1 AUTHOR
Matt S Trout - mst (at) shadowcatsystems.co.uk (Lhttp://www.shadowcatsystems.co.uk/)
=head1 CONTRIBUTORS
=for stopwords Karen Etheridge Shawn M Moore Chris Marshall Matt S Trout Oliver Gorwits יובל קוג'מן (Yuval Kogman) Arthur Axel 'fREW' Schmidt Andrew Alexis Sukrieh Tomas Doran (t0m) epitaph Norbert Buchmuller Jesse Luehrs Dave Houston Dagfinn Ilmari Mannsåker Zakariyya Mughal Ryan Niebur Justin Hunter Ash Berlin naquad Stevan Little
=over 4
=item *
Karen Etheridge ether@cpan.org
=item *
Shawn M Moore code@sartak.org
=item *
Chris Marshall devel.chm.01@gmail.com
=item *
Matt S Trout mst@shadowcat.co.uk
=item *
Oliver Gorwits oliver@cpan.org
=item *
יובל קוג'מן (Yuval Kogman) nothingmuch@woobling.org
=item *
Arthur Axel 'fREW' Schmidt frioux@gmail.com
=item *
Andrew Moore amoore@cpan.org
=item *
Alexis Sukrieh sukria+perl@sukria.net
=item *
Tomas Doran (t0m) bobtfish@bobtfish.net
=item *
epitaph
=item *
Norbert Buchmuller norbi@nix.hu
=item *
Jesse Luehrs doy@tozt.net
=item *
Dave Houston dhouston@cpan.org
=item *
Dagfinn Ilmari Mannsåker ilmari@ilmari.org
=item *
Zakariyya Mughal zaki.mughal@gmail.com
=item *
Ryan Niebur ryan@debian.org
=item *
Justin Hunter justin.d.hunter@gmail.com
=item *
Ash Berlin ash_github@firemirror.com
=item *
naquad naquad@bd8105ee-0ff8-0310-8827-fb3f25b6796d
=item *
Stevan Little stevan.little@iinteractive.com
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (Lhttp://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.
=cut