[Bps-public-commit] r9105 - in Carp-REPL: . lib/Carp lib/Devel/REPL/Plugin t

sartak at bestpractical.com sartak at bestpractical.com
Thu Sep 20 21:48:07 EDT 2007


Author: sartak
Date: Thu Sep 20 21:48:06 2007
New Revision: 9105

Modified:
   Carp-REPL/   (props changed)
   Carp-REPL/lib/Carp/REPL.pm
   Carp-REPL/lib/Devel/REPL/Plugin/LexEnvCarp.pm
   Carp-REPL/t/01-trivial.t
   Carp-REPL/t/02-lexicals.t
   Carp-REPL/t/03-subs.t
   Carp-REPL/t/04-scope.t
   Carp-REPL/t/05-interact.t
   Carp-REPL/t/06-remember.t
   Carp-REPL/t/07-frame.t
   Carp-REPL/t/09-args.t
   Carp-REPL/t/12-env.t
   Carp-REPL/t/99-bug.t
   Carp-REPL/t/scripts/08-alias.pl
   Carp-REPL/t/scripts/11-warn.pl

Log:
 r42952 at onn:  sartak | 2007-09-20 21:39:30 -0400
 Add noprofile option to skip loading the Devel::REPL user config (useful only for testing, really)


Modified: Carp-REPL/lib/Carp/REPL.pm
==============================================================================
--- Carp-REPL/lib/Carp/REPL.pm	(original)
+++ Carp-REPL/lib/Carp/REPL.pm	Thu Sep 20 21:48:06 2007
@@ -1,11 +1,14 @@
 package Carp::REPL;
 use strict;
 use warnings;
+use 5.6.0;
+our $noprofile = 0;
 
 sub import
 {
     my $nodie = grep {$_ eq 'nodie'} @_;
     my $warn  = grep {$_ eq 'warn' } @_;
+    $noprofile = grep {$_ eq 'noprofile'} @_;
 
     $SIG{__DIE__} = \&repl unless $nodie;
     $SIG{__WARN__} = \&repl if $warn;
@@ -63,6 +66,11 @@
 
 I don't see why you would want to do this, but it's available. :)
 
+    use Carp::REPL 'noprofile';
+
+Don't load any per-user L<Devel::REPL> configuration (really only useful for
+testing).
+
 =head1 FUNCTIONS
 
 =head2 repl
@@ -135,18 +143,27 @@
 
     warn $backtrace;
 
-    my $repl = Devel::REPL::Script->new;
+    my ($runner, $repl);
 
-    # LexEnv must come before LexEnvCarp
-    $repl->_repl->load_plugin($_) for qw/LexEnv LexEnvCarp/;
+    if ($noprofile)
+    {
+        $repl = $runner = Devel::REPL->new;
+        $repl->load_plugin('LexEnv');
+    }
+    else
+    {
+        $runner = Devel::REPL::Script->new;
+        $repl = $runner->_repl;
+    }
 
-    $repl->_repl->environments(\@environments);
-    $repl->_repl->packages(\@packages);
-    $repl->_repl->argses(\@argses);
-    $repl->_repl->backtrace($backtrace);
-    $repl->_repl->frame(0);
+    $repl->load_plugin('LexEnvCarp');
 
-    $repl->run;
+    $repl->environments(\@environments);
+    $repl->packages(\@packages);
+    $repl->argses(\@argses);
+    $repl->backtrace($backtrace);
+    $repl->frame(0);
+    $runner->run;
 }
 
 =head1 COMMANDS

Modified: Carp-REPL/lib/Devel/REPL/Plugin/LexEnvCarp.pm
==============================================================================
--- Carp-REPL/lib/Devel/REPL/Plugin/LexEnvCarp.pm	(original)
+++ Carp-REPL/lib/Devel/REPL/Plugin/LexEnvCarp.pm	Thu Sep 20 21:48:06 2007
@@ -1,5 +1,6 @@
 package Devel::REPL::Plugin::LexEnvCarp;
 
+use 5.6.0;
 use Moose::Role;
 use namespace::clean -except => [ 'meta' ];
 use Devel::LexAlias;

Modified: Carp-REPL/t/01-trivial.t
==============================================================================
--- Carp-REPL/t/01-trivial.t	(original)
+++ Carp-REPL/t/01-trivial.t	Thu Sep 20 21:48:06 2007
@@ -8,7 +8,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/01-trivial.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/01-trivial.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/02-lexicals.t
==============================================================================
--- Carp-REPL/t/02-lexicals.t	(original)
+++ Carp-REPL/t/02-lexicals.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/02-lexicals.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/02-lexicals.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/03-subs.t
==============================================================================
--- Carp-REPL/t/03-subs.t	(original)
+++ Carp-REPL/t/03-subs.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/03-subs.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/03-subs.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/04-scope.t
==============================================================================
--- Carp-REPL/t/04-scope.t	(original)
+++ Carp-REPL/t/04-scope.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/04-scope.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/04-scope.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/05-interact.t
==============================================================================
--- Carp-REPL/t/05-interact.t	(original)
+++ Carp-REPL/t/05-interact.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/05-interact.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/05-interact.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/06-remember.t
==============================================================================
--- Carp-REPL/t/06-remember.t	(original)
+++ Carp-REPL/t/06-remember.t	Thu Sep 20 21:48:06 2007
@@ -8,7 +8,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/01-trivial.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/01-trivial.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/07-frame.t
==============================================================================
--- Carp-REPL/t/07-frame.t	(original)
+++ Carp-REPL/t/07-frame.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/07-frame.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/07-frame.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/09-args.t
==============================================================================
--- Carp-REPL/t/09-args.t	(original)
+++ Carp-REPL/t/09-args.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/09-args.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/09-args.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/12-env.t
==============================================================================
--- Carp-REPL/t/12-env.t	(original)
+++ Carp-REPL/t/12-env.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/12-env.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/12-env.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/99-bug.t
==============================================================================
--- Carp-REPL/t/99-bug.t	(original)
+++ Carp-REPL/t/99-bug.t	Thu Sep 20 21:48:06 2007
@@ -6,7 +6,7 @@
 
 expect_run
 (
-    command => 'perl -Ilib -MCarp::REPL t/scripts/07-frame.pl',
+    command => 'perl -Ilib -MCarp::REPL=noprofile t/scripts/07-frame.pl',
     prompt  => '$ ',
     quit    => 'exit',
 );

Modified: Carp-REPL/t/scripts/08-alias.pl
==============================================================================
--- Carp-REPL/t/scripts/08-alias.pl	(original)
+++ Carp-REPL/t/scripts/08-alias.pl	Thu Sep 20 21:48:06 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Carp::REPL;
+use Carp::REPL 'noprofile';
 
 my $numerator = 10;
 my $denominator = 0;

Modified: Carp-REPL/t/scripts/11-warn.pl
==============================================================================
--- Carp-REPL/t/scripts/11-warn.pl	(original)
+++ Carp-REPL/t/scripts/11-warn.pl	Thu Sep 20 21:48:06 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Carp::REPL 'warn';
+use Carp::REPL qw/warn noprofile/;
 
 my $a = 4;
 my $b;



More information about the Bps-public-commit mailing list