[Bps-public-commit] r12401 - in Carp-REPL: lib/Carp
sartak at bestpractical.com
sartak at bestpractical.com
Fri May 16 08:50:53 EDT 2008
Author: sartak
Date: Fri May 16 08:50:51 2008
New Revision: 12401
Modified:
Carp-REPL/ (props changed)
Carp-REPL/lib/Carp/REPL.pm
Log:
r56014 at onn: sartak | 2008-05-16 08:50:08 -0400
Don't inline POD, misc fixes
Modified: Carp-REPL/lib/Carp/REPL.pm
==============================================================================
--- Carp-REPL/lib/Carp/REPL.pm (original)
+++ Carp-REPL/lib/Carp/REPL.pm Fri May 16 08:50:51 2008
@@ -2,6 +2,8 @@
use strict;
use warnings;
use 5.6.0;
+our $VERSION = '0.12';
+
our $noprofile = 0;
sub import {
@@ -13,6 +15,68 @@
$SIG{__WARN__} = \&repl if $warn;
}
+sub repl {
+ warn @_, "\n"; # tell the user what blew up
+
+ require PadWalker;
+ require Devel::REPL::Script;
+
+ my (@packages, @environments, @argses, $backtrace);
+
+ my $frame = 0;
+ while (1) {
+ package DB;
+ my ($package, $file, $line, $subroutine) = caller($frame)
+ or last;
+ $package = 'main' if !defined($package);
+
+ eval {
+ # PadWalker has 0 mean 'current'
+ # caller has 0 mean 'immediate caller'
+ push @environments, PadWalker::peek_my($frame+1);
+ };
+
+ Carp::carp($@), last if $@;
+
+ push @argses, [@DB::args];
+ push @packages, [$package, $file, $line];
+
+ $backtrace .= sprintf "%s%d: %s called at %s:%s.\n",
+ $frame == 0 ? '' : ' ',
+ $frame,
+ $subroutine,
+ $file,
+ $line;
+
+ ++$frame;
+ }
+
+ warn $backtrace;
+
+ my ($runner, $repl);
+
+ if ($noprofile) {
+ $repl = $runner = Devel::REPL->new;
+ }
+ else {
+ $runner = Devel::REPL::Script->new;
+ $repl = $runner->_repl;
+ }
+
+ $repl->load_plugin('Carp::REPL');
+
+ $repl->environments(\@environments);
+ $repl->packages(\@packages);
+ $repl->argses(\@argses);
+ $repl->backtrace($backtrace);
+ $repl->frame(0);
+ $runner->run;
+}
+
+1;
+
+__END__
+
=head1 NAME
Carp::REPL - read-eval-print-loop on die and/or warn
@@ -21,10 +85,6 @@
Version 0.12 released ???
-=cut
-
-our $VERSION = '0.12';
-
=head1 SYNOPSIS
The intended way to use this module is through the command line.
@@ -98,66 +158,6 @@
C<$SIG{__DIE__}> will be invoked and there's no general way to recover. But you
can still change variables to poke at things.
-=cut
-
-sub repl {
- warn @_, "\n"; # tell the user what blew up
-
- require PadWalker;
- require Devel::REPL::Script;
-
- my (@packages, @environments, @argses, $backtrace);
-
- my $frame = 0;
- while (1) {
- package DB;
- my ($package, $file, $line, $subroutine) = caller($frame)
- or last;
- $package = 'main' if !defined($package);
-
- eval {
- # PadWalker has 0 mean 'current'
- # caller has 0 mean 'immediate caller'
- push @environments, PadWalker::peek_my($frame+1);
- };
-
- Carp::carp($@), last if $@;
-
- push @argses, [@DB::args];
- push @packages, [$package, $file, $line];
-
- $backtrace .= sprintf "%s%d: %s called at %s:%s.\n",
- $frame == 0 ? '' : ' ',
- $frame,
- $subroutine,
- $file,
- $line;
-
- ++$frame;
- }
-
- warn $backtrace;
-
- my ($runner, $repl);
-
- if ($noprofile) {
- $repl = $runner = Devel::REPL->new;
- }
- else {
- $runner = Devel::REPL::Script->new;
- $repl = $runner->_repl;
- }
-
- $repl->load_plugin('Carp::REPL');
-
- $repl->environments(\@environments);
- $repl->packages(\@packages);
- $repl->argses(\@argses);
- $repl->backtrace($backtrace);
- $repl->frame(0);
- $runner->run;
-}
-
=head1 COMMANDS
Note that this is not supposed to be a full-fledged debugger. A few commands
@@ -268,12 +268,10 @@
=head1 COPYRIGHT & LICENSE
-Copyright 2007 Best Practical Solutions, all rights reserved.
+Copyright 2007-2008 Best Practical Solutions, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
-1; # End of Carp::REPL
-
More information about the Bps-public-commit
mailing list