Devel-REPL

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    some optional features; Default renamed to Standard (RT#88615)

1.003022   2013-09-10 01:53:10Z
  - workaround added for plugins consuming plugins that use optional features
  - install problems fixed when some optional prereqs are not installed, by
    properly detecting the lack of features during testing (RT#88542)
  - spelling fixes (RT#87691, David Steinbrunner)

1.003021   2013-09-09 02:10:45Z
  - removed use of deprecated functions from Class::MOP
  - long-deprecated Devel::REPL::Plugin::NewlineHack removed at last
  - converted dist to Dist::Zilla, with a different mechanism for specifying
    optional features (install with cpanm --interactive to be prompted)

1.003020   2013-07-08
  - shebang fixed in re.pl so it is rewritten to point to the proper perl at
    install time (RT#70928)

1.003019   2013-06-27
  - Fix "No arguments!" error in Plugin::DDS when nothing to dump (RT#71205,
    Ash Berlin)

Changes  view on Meta::CPAN

  - OutputCache: If sub _ is already defined, then warn about it (once) and refuse to overwrite it
  - Turn MultiLine::PPI's needs_continuation into a method line_needs_continuation
  - Cleanup Plugin::Packages
  - Print a warning when Completion is loaded but the Term::ReadLine object doesn't support completion
  - Introduce error object for error_return
  - Make compile return a single value, use is_error to test if it's bad (it's now an error object instead of undef + error str)
  - Refactor to make it easier to add print/warn to the session
  - Preserve $^H and %^H when using the LexEnv plugin
  - Refactor the finding of the last element of the document into a method in Completion
  - Use namespaace::clean in turtles completion driver
  - Use Devel::REPL::Plugin instead of Moose::Role
  - Use "BEFORE_PLUGIN { load_plugin }" instead of "with"
  - Fix from Sartak for end-of-line comment bug reported by jrockway
  - Allow exception objects.
  - Don't initialize a turtles matcher if we don't need to
  - Improve the MultiLine::PPI plugin by checking whether adding ;; will end in PPI::Statement::Null. If not, then there must be some incomplete structure
  - Respect env var DEVEL_REPL_PROFILE
  -
  - Devel::REPL::Plugin::Peek
  - Devel::REPL::Plugin::B::Concise
  - Add CompletionDriver::Turtles
  - Devel::REPL::Error
  - Add a Nopaste plugin. #nopaste will publish your current session using App::Nopaste
  - Add the @INC completion driver.
  - Devel::REPL::Plugin::CompletionDriver::Globals
  - Add a PPI plugin for #ppi CODE
  - CompletionDriver::Methods which currently only works on classnames
  - FindVariable plugin, which returns a reference to a global variable by name
  -
  - Update dependencies
  - Give "NAME" pod sections to all the plugins
  - Add AUTHOR sections where I know off the top of my head who wrote the plugin
  - Expand some of the user documentation

1.002001   2008-02-24

META.json  view on Meta::CPAN

         "version" : "1.003029"
      },
      "Devel::REPL::Error" : {
         "file" : "lib/Devel/REPL/Error.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Meta::Plugin" : {
         "file" : "lib/Devel/REPL/Meta/Plugin.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin" : {
         "file" : "lib/Devel/REPL/Plugin.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::B::Concise" : {
         "file" : "lib/Devel/REPL/Plugin/B/Concise.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Colors" : {
         "file" : "lib/Devel/REPL/Plugin/Colors.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Commands" : {
         "file" : "lib/Devel/REPL/Plugin/Commands.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Completion" : {
         "file" : "lib/Devel/REPL/Plugin/Completion.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::CompletionDriver::Globals" : {
         "file" : "lib/Devel/REPL/Plugin/CompletionDriver/Globals.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::CompletionDriver::INC" : {
         "file" : "lib/Devel/REPL/Plugin/CompletionDriver/INC.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::CompletionDriver::Keywords" : {
         "file" : "lib/Devel/REPL/Plugin/CompletionDriver/Keywords.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::CompletionDriver::LexEnv" : {
         "file" : "lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::CompletionDriver::Methods" : {
         "file" : "lib/Devel/REPL/Plugin/CompletionDriver/Methods.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::CompletionDriver::Turtles" : {
         "file" : "lib/Devel/REPL/Plugin/CompletionDriver/Turtles.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::DDC" : {
         "file" : "lib/Devel/REPL/Plugin/DDC.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::DDS" : {
         "file" : "lib/Devel/REPL/Plugin/DDS.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::DumpHistory" : {
         "file" : "lib/Devel/REPL/Plugin/DumpHistory.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::FancyPrompt" : {
         "file" : "lib/Devel/REPL/Plugin/FancyPrompt.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::FindVariable" : {
         "file" : "lib/Devel/REPL/Plugin/FindVariable.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::History" : {
         "file" : "lib/Devel/REPL/Plugin/History.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Interrupt" : {
         "file" : "lib/Devel/REPL/Plugin/Interrupt.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::LexEnv" : {
         "file" : "lib/Devel/REPL/Plugin/LexEnv.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::MultiLine::PPI" : {
         "file" : "lib/Devel/REPL/Plugin/MultiLine/PPI.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Nopaste" : {
         "file" : "lib/Devel/REPL/Plugin/Nopaste.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::OutputCache" : {
         "file" : "lib/Devel/REPL/Plugin/OutputCache.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::PPI" : {
         "file" : "lib/Devel/REPL/Plugin/PPI.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Packages" : {
         "file" : "lib/Devel/REPL/Plugin/Packages.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Peek" : {
         "file" : "lib/Devel/REPL/Plugin/Peek.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::ReadLineHistory" : {
         "file" : "lib/Devel/REPL/Plugin/ReadLineHistory.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Refresh" : {
         "file" : "lib/Devel/REPL/Plugin/Refresh.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::ShowClass" : {
         "file" : "lib/Devel/REPL/Plugin/ShowClass.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Timing" : {
         "file" : "lib/Devel/REPL/Plugin/Timing.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Plugin::Turtles" : {
         "file" : "lib/Devel/REPL/Plugin/Turtles.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Profile" : {
         "file" : "lib/Devel/REPL/Profile.pm",
         "version" : "1.003029"
      },
      "Devel::REPL::Profile::Default" : {
         "file" : "lib/Devel/REPL/Profile/Default.pm",
         "version" : "1.003029"

META.yml  view on Meta::CPAN

provides:
  Devel::REPL:
    file: lib/Devel/REPL.pm
    version: '1.003029'
  Devel::REPL::Error:
    file: lib/Devel/REPL/Error.pm
    version: '1.003029'
  Devel::REPL::Meta::Plugin:
    file: lib/Devel/REPL/Meta/Plugin.pm
    version: '1.003029'
  Devel::REPL::Plugin:
    file: lib/Devel/REPL/Plugin.pm
    version: '1.003029'
  Devel::REPL::Plugin::B::Concise:
    file: lib/Devel/REPL/Plugin/B/Concise.pm
    version: '1.003029'
  Devel::REPL::Plugin::Colors:
    file: lib/Devel/REPL/Plugin/Colors.pm
    version: '1.003029'
  Devel::REPL::Plugin::Commands:
    file: lib/Devel/REPL/Plugin/Commands.pm
    version: '1.003029'
  Devel::REPL::Plugin::Completion:
    file: lib/Devel/REPL/Plugin/Completion.pm
    version: '1.003029'
  Devel::REPL::Plugin::CompletionDriver::Globals:
    file: lib/Devel/REPL/Plugin/CompletionDriver/Globals.pm
    version: '1.003029'
  Devel::REPL::Plugin::CompletionDriver::INC:
    file: lib/Devel/REPL/Plugin/CompletionDriver/INC.pm
    version: '1.003029'
  Devel::REPL::Plugin::CompletionDriver::Keywords:
    file: lib/Devel/REPL/Plugin/CompletionDriver/Keywords.pm
    version: '1.003029'
  Devel::REPL::Plugin::CompletionDriver::LexEnv:
    file: lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm
    version: '1.003029'
  Devel::REPL::Plugin::CompletionDriver::Methods:
    file: lib/Devel/REPL/Plugin/CompletionDriver/Methods.pm
    version: '1.003029'
  Devel::REPL::Plugin::CompletionDriver::Turtles:
    file: lib/Devel/REPL/Plugin/CompletionDriver/Turtles.pm
    version: '1.003029'
  Devel::REPL::Plugin::DDC:
    file: lib/Devel/REPL/Plugin/DDC.pm
    version: '1.003029'
  Devel::REPL::Plugin::DDS:
    file: lib/Devel/REPL/Plugin/DDS.pm
    version: '1.003029'
  Devel::REPL::Plugin::DumpHistory:
    file: lib/Devel/REPL/Plugin/DumpHistory.pm
    version: '1.003029'
  Devel::REPL::Plugin::FancyPrompt:
    file: lib/Devel/REPL/Plugin/FancyPrompt.pm
    version: '1.003029'
  Devel::REPL::Plugin::FindVariable:
    file: lib/Devel/REPL/Plugin/FindVariable.pm
    version: '1.003029'
  Devel::REPL::Plugin::History:
    file: lib/Devel/REPL/Plugin/History.pm
    version: '1.003029'
  Devel::REPL::Plugin::Interrupt:
    file: lib/Devel/REPL/Plugin/Interrupt.pm
    version: '1.003029'
  Devel::REPL::Plugin::LexEnv:
    file: lib/Devel/REPL/Plugin/LexEnv.pm
    version: '1.003029'
  Devel::REPL::Plugin::MultiLine::PPI:
    file: lib/Devel/REPL/Plugin/MultiLine/PPI.pm
    version: '1.003029'
  Devel::REPL::Plugin::Nopaste:
    file: lib/Devel/REPL/Plugin/Nopaste.pm
    version: '1.003029'
  Devel::REPL::Plugin::OutputCache:
    file: lib/Devel/REPL/Plugin/OutputCache.pm
    version: '1.003029'
  Devel::REPL::Plugin::PPI:
    file: lib/Devel/REPL/Plugin/PPI.pm
    version: '1.003029'
  Devel::REPL::Plugin::Packages:
    file: lib/Devel/REPL/Plugin/Packages.pm
    version: '1.003029'
  Devel::REPL::Plugin::Peek:
    file: lib/Devel/REPL/Plugin/Peek.pm
    version: '1.003029'
  Devel::REPL::Plugin::ReadLineHistory:
    file: lib/Devel/REPL/Plugin/ReadLineHistory.pm
    version: '1.003029'
  Devel::REPL::Plugin::Refresh:
    file: lib/Devel/REPL/Plugin/Refresh.pm
    version: '1.003029'
  Devel::REPL::Plugin::ShowClass:
    file: lib/Devel/REPL/Plugin/ShowClass.pm
    version: '1.003029'
  Devel::REPL::Plugin::Timing:
    file: lib/Devel/REPL/Plugin/Timing.pm
    version: '1.003029'
  Devel::REPL::Plugin::Turtles:
    file: lib/Devel/REPL/Plugin/Turtles.pm
    version: '1.003029'
  Devel::REPL::Profile:
    file: lib/Devel/REPL/Profile.pm
    version: '1.003029'
  Devel::REPL::Profile::Default:
    file: lib/Devel/REPL/Profile/Default.pm
    version: '1.003029'
  Devel::REPL::Profile::Minimal:
    file: lib/Devel/REPL/Profile/Minimal.pm

lib/Devel/REPL.pm  view on Meta::CPAN

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<my> keyword will automatically persist between statements executed in the
REPL shell.

When you C<use> any Perl module, the C<import()> will work as expected - the
exported functions from that module are available for immediate use:

lib/Devel/REPL.pm  view on Meta::CPAN

this feature, please see the L<Devel::REPL::Profile> manual page.

A C<Standard> profile ships with C<Devel::REPL>; it loads the following plugins
(note that some of these require optional features -- or you can also use the
C<Minimal> profile):

=over 4

=item *

L<Devel::REPL::Plugin::History>

=item *

L<Devel::REPL::Plugin::LexEnv>

=item *

L<Devel::REPL::Plugin::DDS>

=item *

L<Devel::REPL::Plugin::Packages>

=item *

L<Devel::REPL::Plugin::Commands>

=item *

L<Devel::REPL::Plugin::MultiLine::PPI>

=item *

L<Devel::REPL::Plugin::Colors>

=item *

L<Devel::REPL::Plugin::Completion>

=item *

L<Devel::REPL::Plugin::CompletionDriver::INC>

=item *

L<Devel::REPL::Plugin::CompletionDriver::LexEnv>

=item *

L<Devel::REPL::Plugin::CompletionDriver::Keywords>

=item *

L<Devel::REPL::Plugin::CompletionDriver::Methods>

=item *

L<Devel::REPL::Plugin::ReadlineHistory>

=back

=head2 Plugins

Plugins are a way to add functionality to the REPL shell, and take advantage of
C<Devel::REPL> being based on the L<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.

A number of plugins ship with C<Devel::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
L<Devel::REPL::Plugin> manual page, along with links to the manual pages of
all the plugins shipped with C<Devel::REPL>.

=head2 The REPL shell object

From time to time you'll want to interact with or manipulate the
C<Devel::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

lib/Devel/REPL/Overview.pod  view on Meta::CPAN


=head2 I want it to bark, fly, jump and swim! or Plugins

Plugins extend functionality and change behavior of Devel::REPL.
Bundled plugins are:

=over 2

=item *

L<Devel::REPL::Plugin::History>
  No comments. Simply history.

=item *

L<Devel::REPL::Plugin::!LexEnv>
  Provides a lexical environment for the Devel::REPL.

=item *

L<Devel::REPL::Plugin::DDS>
  Formats return values with Data::Dump::Streamer module.

=item *

L<Devel::REPL::Plugin::Packages>
  Keeps track of which package your're in.

=item *

L<Devel::REPL::Plugin::Commands>
  Generic command creation plugin using injected functions.

=item *

L<Devel::REPL::Plugin::MultiLine::PPI>
  Makes Devel::REPL read your input until your block
  is finished. What does this means: you can type a part of a block
  on one line and second part on another:

       $ sub mysub {

       > print "Hello, World!\n"; ## notice prompt change

       > }

lib/Devel/REPL/Overview.pod  view on Meta::CPAN

      $ re.pl --profile SomeProfile

Alternatively, you can set the environment variable C<DEVEL_REPL_PROFILE> to
C<SomeProfile>, or set the C<profile> key in your C<rcfile> (see
L<Devel::REPL> for more information).

=head1 SEE ALSO

=for :list
* L<Devel::REPL>
* L<Devel::REPL::Plugin>
* L<Devel::REPL::Profile>
* L<Reply>

=cut

lib/Devel/REPL/Plugin.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin;

our $VERSION = '1.003029';

use Devel::REPL::Meta::Plugin;
use Moose::Role ();
use namespace::autoclean;

sub import {
  my $target = caller;
  Devel::REPL::Meta::Plugin->initialize($target);

lib/Devel/REPL/Plugin/B/Concise.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::B::Concise;
# ABSTRACT: B::Concise dumping of expression optrees

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use B::Concise 0.62 ();
use namespace::autoclean;

B::Concise::compileOpts qw(-nobanner);

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Turtles');
}

lib/Devel/REPL/Plugin/B/Concise.pm  view on Meta::CPAN

__PACKAGE__

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::B::Concise - B::Concise dumping of expression optrees

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

  repl> #concise -exec -terse {
  > foo => foo(),
  > }
  COP (0x138b1e0) nextstate
  OP (0x13bd280) pushmark
  SVOP (0x138c6a0) const  PV (0xbbab50) "foo"
  OP (0x13bbae0) pushmark
  SVOP (0x13bcee0) gv  GV (0xbbb250) *Devel::REPL::Plugin::B::Concise::foo
  UNOP (0x13890a0) entersub [1]
  LISTOP (0x13ba020) anonhash
  UNOP (0x5983d0) leavesub [1]

=head1 DESCRIPTION

This plugin provides a C<concise> command that uses L<B::Concise> to dump
optrees of expressions.

The code is not actually executed, which means that when used with

lib/Devel/REPL/Plugin/Colors.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Colors;
# ABSTRACT: Add color to return values, warnings, and errors

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Term::ANSIColor;
use namespace::autoclean;

has normal_color => (
  is => 'rw', lazy => 1,
  default => 'green',
);

has error_color => (
  is => 'rw', lazy => 1,

lib/Devel/REPL/Plugin/Colors.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Colors - Add color to return values, warnings, and errors

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

    use Devel::REPL;

    my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/Commands.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Commands;
# ABSTRACT: Generic command creation plugin using injected functions

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Scalar::Util qw(weaken);
use namespace::autoclean;

our $COMMAND_INSTALLER;

has 'command_set' => (
  is => 'ro',
  lazy => 1, default => sub { {} }
);

lib/Devel/REPL/Plugin/Commands.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Commands - Generic command creation plugin using injected functions

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/Completion.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Completion;
# ABSTRACT: Extensible tab completion

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Scalar::Util 'weaken';
use PPI;
use namespace::autoclean;

has current_matches => (
   is => 'rw',
   isa => 'ArrayRef',
   lazy => 1,
   default => sub { [] },
);

lib/Devel/REPL/Plugin/Completion.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Completion - Extensible tab completion

=head1 VERSION

version 1.003029

=head1 NOTE

By default, the Completion plugin explicitly does I<not> use the Gnu readline
or Term::ReadLine::Perl fallback filename completion.

lib/Devel/REPL/Plugin/CompletionDriver/Globals.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::CompletionDriver::Globals;
# ABSTRACT: Complete global variables, packages, namespaced functions

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::REPL::Plugin::Completion;    # die early if cannot load
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Completion');
}

around complete => sub {
  my $orig = shift;
  my ($self, $text, $document) = @_;

lib/Devel/REPL/Plugin/CompletionDriver/Globals.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::CompletionDriver::Globals - Complete global variables, packages, namespaced functions

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/CompletionDriver/INC.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::CompletionDriver::INC;
# ABSTRACT: Complete module names in use and require

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::REPL::Plugin::Completion;    # die early if cannot load
use File::Next;
use File::Spec;
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Completion');
}

around complete => sub {

lib/Devel/REPL/Plugin/CompletionDriver/INC.pm  view on Meta::CPAN


  # split drops trailing fields
  push @directories, '' if $package =~ /(?:$insep)$/;
  my $final = pop @directories;
  my $final_re = qr/^\Q$final/;

  my @found;

  # most VCSes don't litter every single fucking directory with garbage. if you
  # know of any other, just stick them in here. No one wants to complete
  # Devel::REPL::Plugin::.svn
  my %ignored =
  (
      '.'    => 1,
      '..'   => 1,
      '.svn' => 1,
  );

  # this will take a directory and add to @found all of the possible matches
  my $add_recursively;
  $add_recursively = sub {

lib/Devel/REPL/Plugin/CompletionDriver/INC.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::CompletionDriver::INC - Complete module names in use and require

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/CompletionDriver/Keywords.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::CompletionDriver::Keywords;
# ABSTRACT: Complete Perl keywords and operators

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::REPL::Plugin::Completion;    # die early if cannot load
use B::Keywords qw/@Functions @Barewords/;
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Completion');
}

around complete => sub {
  my $orig = shift;

lib/Devel/REPL/Plugin/CompletionDriver/Keywords.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::CompletionDriver::Keywords - Complete Perl keywords and operators

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::CompletionDriver::LexEnv;
# ABSTRACT: Complete variable names in the REPL's lexical environment

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::REPL::Plugin::Completion;    # die early if cannot load
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Completion');
}

around complete => sub {
  my $orig = shift;
  my ($self, $text, $document) = @_;

lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::CompletionDriver::LexEnv - Complete variable names in the REPL's lexical environment

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/CompletionDriver/Methods.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::CompletionDriver::Methods;
# ABSTRACT: Complete class or object method names

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::REPL::Plugin::Completion;    # die early if cannot load
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    for (qw/Completion FindVariable/) {
        $self->load_plugin($_);
    }
}

around complete => sub {

lib/Devel/REPL/Plugin/CompletionDriver/Methods.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::CompletionDriver::Methods - Complete class or object method names

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/CompletionDriver/Turtles.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::CompletionDriver::Turtles;
# ABSTRACT: Complete Turtles-based commands

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::REPL::Plugin::Completion;    # die early if cannot load
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Completion');
}

around complete => sub {
  my $orig = shift;
  my ($self, $text, $document) = @_;

lib/Devel/REPL/Plugin/CompletionDriver/Turtles.pm  view on Meta::CPAN

__PACKAGE__

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::CompletionDriver::Turtles - Complete Turtles-based commands

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/DDC.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::DDC;
# ABSTRACT: Format results with Data::Dumper::Concise

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Data::Dumper::Concise ();
use namespace::autoclean;

around 'format_result' => sub {
  my $orig = shift;
  my $self = shift;
  my $to_dump = (@_ > 1) ? [@_] : $_[0];
  my $out;
  if (ref $to_dump) {
    if (overload::Method($to_dump, '""')) {

lib/Devel/REPL/Plugin/DDC.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::DDC - Format results with Data::Dumper::Concise

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

 # in your re.pl file:
 use Devel::REPL;
 my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/DDS.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::DDS;
# ABSTRACT: Format results with Data::Dump::Streamer

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Data::Dump::Streamer ();
use namespace::autoclean;

around 'format_result' => sub {
   my $orig = shift;
   my $self = shift;
   my @to_dump = @_;
   my $out;
   if (@to_dump > 1 || ref $to_dump[0]) {
      if (@to_dump == 1 && overload::Method($to_dump[0], '""')) {

lib/Devel/REPL/Plugin/DDS.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::DDS - Format results with Data::Dump::Streamer

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

 # in your re.pl file:
 use Devel::REPL;
 my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/DumpHistory.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::DumpHistory;
# ABSTRACT: Plugin for Devel::REPL to save or print the history

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;

## Seems to be a sequence issue with requires
# requires qw{ history };

around 'read' => sub {
  my $orig = shift;
  my ($self, @args) = @_;

  my $line = $self->$orig(@args);

lib/Devel/REPL/Plugin/DumpHistory.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::DumpHistory - Plugin for Devel::REPL to save or print the history

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

    use Devel::REPL;

    my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/FancyPrompt.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::FancyPrompt;
# ABSTRACT: Facilitate user-defined prompts

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;

has 'fancy_prompt' => (
  is => 'rw', lazy => 1,

  # yes, this needs to be a double sub
  default => sub {
    sub {
      my $self = shift;
      sprintf 're.pl(%s):%03d%s> ',

lib/Devel/REPL/Plugin/FancyPrompt.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::FancyPrompt - Facilitate user-defined prompts

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

    use Devel::REPL;

    my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/FancyPrompt.pm  view on Meta::CPAN

default can be implemented with:

    $_REPL->fancy_prompt(sub {
      my $self = shift;
      sprintf 're.pl(%s):%03d%s> ',
              $self->can('current_package') ? $self->current_package : 'main',
              $self->lines_read,
              $self->can('line_depth') ? ':' . $self->line_depth : '';
    });

C<current_package> is provided by L<Devel::REPL::Plugin::Packages> (which
tracks the current package). C<line_depth> is provided by a C<MultiLine> plugin
(probably C<MultiLine::PPI>).

You may also set a C<fancy_continuation_prompt>. The default is very similar to
C<fancy_prompt>'s default (except C<*> instead of C<< > >>).

=head1 SEE ALSO

C<Devel::REPL>

lib/Devel/REPL/Plugin/FindVariable.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::FindVariable;
# ABSTRACT: Finds variables by name

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;

sub find_variable {
    my ($self, $name) = @_;

    return \$self if $name eq '$_REPL';

    # XXX: this code needs to live in LexEnv
    if ($self->can('lexical_environment')) {
        return \( $self->lexical_environment->get_context('_')->{$name} )

lib/Devel/REPL/Plugin/FindVariable.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::FindVariable - Finds variables by name

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/History.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::History;
# ABSTRACT: Keep track of all input, provide shortcuts !1, !-1

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;

has 'history' => (
   isa => 'ArrayRef', is => 'rw',
   lazy => 1,
   default => sub { [] }
);

# lazy so ReadLineHistory Plugin can set this
has 'have_readline_history' => (

lib/Devel/REPL/Plugin/History.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::History - Keep track of all input, provide shortcuts !1, !-1

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/Interrupt.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Interrupt;
# ABSTRACT: Traps SIGINT to kill long-running lines

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Sys::SigAction qw(set_sig_handler);
use namespace::autoclean;

around 'run' => sub {
    my ($orig, $self) = (shift, shift);

    local $SIG{INT} = 'IGNORE';

    return $self->$orig(@_);
};

lib/Devel/REPL/Plugin/Interrupt.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Interrupt - Traps SIGINT to kill long-running lines

=head1 VERSION

version 1.003029

=head1 DESCRIPTION

By default L<Devel::REPL> exits on SIGINT (usually Ctrl-C). If you load this
module, SIGINT will be trapped and used to kill long-running commands
(statements) and also to kill the line being edited (like eg. BASH do). (You

lib/Devel/REPL/Plugin/LexEnv.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::LexEnv;
# ABSTRACT: Provide a lexical environment for the REPL

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;
use Lexical::Persistence;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('FindVariable');
}

has 'lexical_environment' => (
  isa => 'Lexical::Persistence',

lib/Devel/REPL/Plugin/LexEnv.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::LexEnv - Provide a lexical environment for the REPL

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

 # in your re.pl file:
 use Devel::REPL;
 my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/MultiLine/PPI.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::MultiLine::PPI;
# ABSTRACT: Read lines until all blocks are closed

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use PPI;
use namespace::autoclean;

has 'continuation_prompt' => (
  is => 'rw',
  lazy => 1,
  default => sub { '> ' }
);

has 'line_depth' => (

lib/Devel/REPL/Plugin/MultiLine/PPI.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::MultiLine::PPI - Read lines until all blocks are closed

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

    use Devel::REPL;

    my $repl = Devel::REPL->new;

lib/Devel/REPL/Plugin/Nopaste.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Nopaste;
# ABSTRACT: #nopaste to upload session's input and output

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Moose::Util::TypeConstraints 'enum';
use namespace::autoclean;
use Scalar::Util qw(blessed);

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Turtles');
}

has complete_session => (

lib/Devel/REPL/Plugin/Nopaste.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Nopaste - #nopaste to upload session's input and output

=head1 VERSION

version 1.003029

=head1 COMMANDS

This module provides these commands to your Devel::REPL shell:

=head2 #nopaste

lib/Devel/REPL/Plugin/OutputCache.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::OutputCache;
# ABSTRACT: Remember past results, _ is most recent

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;

has output_cache => (
    is      => 'rw',
    isa     => 'ArrayRef',
    default => sub { [] },
    lazy    => 1,
);

has warned_about_underscore => (

lib/Devel/REPL/Plugin/OutputCache.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::OutputCache - Remember past results, _ is most recent

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

    > 21 / 7
    3
    > _ * _

lib/Devel/REPL/Plugin/OutputCache.pm  view on Meta::CPAN

    Runtime error: later

=head1 DESCRIPTION

Re-using results is very useful when working in a REPL. With C<OutputCache> you
get C<_>, which holds the past result. The benefit is that you can build up
your result instead of having to type it in all at once, or store it in
intermediate variables. C<OutputCache> also provides
C<< $_REPL->output_cache >>, an array reference of all results in this session.

L<Devel::REPL> already has a similar plugin, L<Devel::REPL::Plugin::History>.
There are some key differences though:

=over 4

=item Input vs Output

C<History> remembers input. C<OutputCache> remembers output.

=item Munging vs Pure Perl

lib/Devel/REPL/Plugin/OutputCache.pm  view on Meta::CPAN


=head1 CAVEATS

The C<_> sub is shared across all packages. This means that if a module is
using the C<_> sub, then there is a conflict and you should not use this
plugin. For example, L<Jifty> uses the C<_> sub for localization. L<Jifty> is the
only known user.

=head1 SEE ALSO

C<Devel::REPL>, C<Devel::REPL::Plugin::History>

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

There is also an irc channel available for users of this distribution, at
L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>.

=head1 AUTHOR

lib/Devel/REPL/Plugin/PPI.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::PPI;
# ABSTRACT: PPI dumping of Perl code

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use PPI;
use PPI::Dumper;
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Turtles');
}

sub expr_command_ppi {

lib/Devel/REPL/Plugin/PPI.pm  view on Meta::CPAN

__PACKAGE__

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::PPI - PPI dumping of Perl code

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

  repl> #ppi Devel::REPL
  PPI::Document
    PPI::Statement

lib/Devel/REPL/Plugin/Packages.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Packages;
# ABSTRACT: Keep track of which package the user is in

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use namespace::autoclean;

our $PKG_SAVE;

has 'current_package' => (
  isa      => 'Str',
  is       => 'rw',
  default  => 'Devel::REPL::Plugin::Packages::DefaultScratchpad',
  lazy     => 1
);

around 'wrap_as_sub' => sub {
  my $orig = shift;
  my ($self, @args) = @_;
  my $line = $self->$orig(@args);
  # prepend package def before sub { ... }
  return q!package !.$self->current_package.qq!;\n${line}!;
};

around 'mangle_line' => sub {
  my $orig = shift;
  my ($self, @args) = @_;
  my $line = $self->$orig(@args);
  # add a BEGIN block to set the package around at the end of the sub
  # without mangling the return value (we save it off into a global)
  $line .= '
; BEGIN { $Devel::REPL::Plugin::Packages::PKG_SAVE = __PACKAGE__; }';
  return $line;
};

after 'execute' => sub {
  my ($self) = @_;
  # if we survived execution successfully, save the new package out the global
  $self->current_package($PKG_SAVE) if defined $PKG_SAVE;
};

around 'eval' => sub {
  my $orig = shift;
  my ($self, @args) = @_;
  # localise the $PKG_SAVE global in case of nested evals
  local $PKG_SAVE;
  return $self->$orig(@args);
};

package # hide from PAUSE
    Devel::REPL::Plugin::Packages::DefaultScratchpad;

# declare empty scratchpad package for cleanliness

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Packages - Keep track of which package the user is in

=head1 VERSION

version 1.003029

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).

lib/Devel/REPL/Plugin/Peek.pm  view on Meta::CPAN

use strict;
use warnings;
package Devel::REPL::Plugin::Peek;
# ABSTRACT: L<Devel::Peek> plugin for L<Devel::REPL>.

our $VERSION = '1.003029';

use Devel::REPL::Plugin;
use Devel::Peek qw(Dump);
use namespace::autoclean;

sub BEFORE_PLUGIN {
    my $self = shift;
    $self->load_plugin('Turtles');
}

sub expr_command_peek {
  my ( $self, $eval, $code ) = @_;

lib/Devel/REPL/Plugin/Peek.pm  view on Meta::CPAN

__PACKAGE__

__END__

=pod

=encoding UTF-8

=head1 NAME

Devel::REPL::Plugin::Peek - L<Devel::Peek> plugin for L<Devel::REPL>.

=head1 VERSION

version 1.003029

=head1 SYNOPSIS

  repl> #peek "foo"
  SV = PV(0xb3dba0) at 0xb4abc0
    REFCNT = 1
    FLAGS = (POK,READONLY,pPOK)
    PV = 0x12bcf70 "foo"\0
    CUR = 3
    LEN = 4

=head1 DESCRIPTION

This L<Devel::REPL::Plugin> adds a C<peek> command that calls
L<Devel::Peek/Dump> instead of the normal printing.

=head1 SEE ALSO

L<Devel::REPL>, L<Devel::Peek>

=head1 SUPPORT

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).



( run in 0.561 second using v1.01-cache-2.11-cpan-4ee56698ea0 )