Devel-REPL-InProcess

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      "Devel::REPL::Client::AnyEvent::Connection" : {
         "file" : "lib/Devel/REPL/Client/AnyEvent/Connection.pm"
      },
      "Devel::REPL::Client::Select" : {
         "file" : "lib/Devel/REPL/Client/Select.pm"
      },
      "Devel::REPL::InProcess" : {
         "file" : "lib/Devel/REPL/InProcess.pm",
         "version" : "0.05"
      },
      "Devel::REPL::Plugin::InProcess" : {
         "file" : "lib/Devel/REPL/Plugin/InProcess.pm"
      },
      "Devel::REPL::Server::Select" : {
         "file" : "lib/Devel/REPL/Server/Select.pm"
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://github.com/mbarbon/devel-repl-inprocess/issues"

META.yml  view on Meta::CPAN

provides:
  Devel::REPL::Client::AnyEvent:
    file: lib/Devel/REPL/Client/AnyEvent.pm
  Devel::REPL::Client::AnyEvent::Connection:
    file: lib/Devel/REPL/Client/AnyEvent/Connection.pm
  Devel::REPL::Client::Select:
    file: lib/Devel/REPL/Client/Select.pm
  Devel::REPL::InProcess:
    file: lib/Devel/REPL/InProcess.pm
    version: '0.05'
  Devel::REPL::Plugin::InProcess:
    file: lib/Devel/REPL/Plugin/InProcess.pm
  Devel::REPL::Server::Select:
    file: lib/Devel/REPL/Server/Select.pm
requires:
  AnyEvent: '1.0031'
  Devel::REPL: '1.003012'
  IO::Pty: '1.12'
  PadWalker: '2.2'
  Term::ReadKey: '2.30'
  Term::ReadLine: '1.14'

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

    inprocess-repl-client --port 7654 --once

    # somewhere in a running program
    Devel::REPL::Server::Select->run_repl(port => 7654);

=head1 DESCRIPTION

This distribution provides a debugger-like REPL session that can be
spawned in the middle of a program.

L<Devel::REPL::Plugin::InProcess> synchronized the lexical environment
of the REPL with the environemnt where the shell was spawned (which
means you will be able to inspect and modify in-scope lexicals).

C<Devel::REPL::Server::*> and C<Devel::REPL::Client::*> allow using
the REPL for processes not attached to a console.

=cut

use strict;
use warnings;

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

package Devel::REPL::Plugin::InProcess;

use Devel::REPL::Plugin;
use PadWalker ();
use namespace::clean -except => [ 'meta' ];

has '_caller_depth' => (
    isa     => 'Int',
    is      => 'rw',
);

has '_package' => (
    isa     => 'Str',

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

}

around 'execute' => sub {
    my ($orig, $_REPL, @args) = @_;
    $_REPL->_sync_to_lexenv;
    my @res = $_REPL->$orig(@args);
    $_REPL->_sync_from_lexenv;
    return @res;
};

# stolen from Devel::REPL::Plugin::Package
around 'wrap_as_sub' => sub {
    my ($orig, $_REPL, @args) = @_;
    $_REPL->_find_level_and_initialize unless $_REPL->_caller_depth;
    my $line = $_REPL->$orig(@args);
    return sprintf "package %s;\n%s", $_REPL->_package, $line;
};

sub _sync_to_lexenv {
    my ($self) = @_;
    my $cxt = $self->lexical_environment->get_context('_');

t/001_load.t  view on Meta::CPAN

#!/usr/bin/perl

use Test::More tests => 5;

use_ok('Devel::REPL::InProcess');
use_ok('Devel::REPL::Plugin::InProcess');
use_ok('Devel::REPL::Server::Select');
use_ok('Devel::REPL::Client::Select');
use_ok('Devel::REPL::Client::AnyEvent');



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