3 Commits

Author SHA1 Message Date
Florian Ragwitz
f423aee854 Import of FLORA/CatalystX-REPL-0.04 from CPAN.
gitpan-cpan-distribution: CatalystX-REPL
gitpan-cpan-version:      0.04
gitpan-cpan-path:         FLORA/CatalystX-REPL-0.04.tar.gz
gitpan-cpan-author:       FLORA
gitpan-cpan-maturity:     released
2014-10-23 17:34:26 -05:00
Florian Ragwitz
6b402d3357 Import of FLORA/CatalystX-REPL-0.03 from CPAN.
gitpan-cpan-distribution: CatalystX-REPL
gitpan-cpan-version:      0.03
gitpan-cpan-path:         FLORA/CatalystX-REPL-0.03.tar.gz
gitpan-cpan-author:       FLORA
gitpan-cpan-maturity:     released
2014-10-23 17:34:26 -05:00
Ash Berlin
46bb37363c Import of ASH/CatalystX-REPL-0.02 from CPAN.
gitpan-cpan-distribution: CatalystX-REPL
gitpan-cpan-version:      0.02
gitpan-cpan-path:         ASH/CatalystX-REPL-0.02.tar.gz
gitpan-cpan-author:       ASH
gitpan-cpan-maturity:     released
2014-10-23 17:34:26 -05:00
13 changed files with 147 additions and 37 deletions

10
Changes
View File

@@ -1,2 +1,12 @@
0.04 Tue, 11 Aug 2009 05:59:35 +0200
* Fix test failures with recent versions of Class::MOP.
* Switch from namespace::clean to namespace::autoclean.
0.03 Fri, 10 Apr 2009 01:47:22 +0200
* Allow passing options to Carp::REPL.
0.02 Mon, 06 Apr 2009 22:28:52 +0100
* Doc improvmens (Ash Berlin, spurned on by Jon Rockway)
0.01 Thu, 26 Feb 2009 14:31:40 +0100
* Initial release.

View File

@@ -1,9 +1,9 @@
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
the same terms as perl itself.
the same terms as the Perl 5 programming language system itself.
Terms of Perl itself
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any

View File

@@ -9,4 +9,6 @@ lib/CatalystX/REPL.pm
t/basic.t
t/lib/TestApp.pm
t/lib/TestApp/Controller/Foo.pm
t/release-pod-coverage.t
t/release-pod-syntax.t
t/request.pl

View File

@@ -1,13 +1,17 @@
---
abstract: read-eval-print-loop for debugging your Catalyst application
author:
- Tomas Doram <bobtfish@bobtfish.net>
- Florian Ragwitz <rafl@debian.org>
generated_by: Dist::Zilla::Plugin::MetaYaml version 1.004
---
abstract: 'read-eval-print-loop for debugging your Catalyst application'
author:
- 'Tomas Doran <bobtfish@bobtfish.net>'
- 'Florian Ragwitz <rafl@debian.org>'
- 'Ash Berlin <ash@cpan.org>'
generated_by: 'Dist::Zilla::Plugin::MetaYAML version 1.092200'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: CatalystX-REPL
requires:
requires:
Carp::REPL: 0
Catalyst: 5.800006
namespace::clean: 0
version: 0.01
namespace::autoclean: 0
version: 0.04

View File

@@ -7,13 +7,13 @@ use ExtUtils::MakeMaker;
WriteMakefile(
DISTNAME => 'CatalystX-REPL',
NAME => 'CatalystX::REPL',
AUTHOR => 'Tomas\ Doram\ \<bobtfish\@bobtfish\.net\>\,\ Florian\ Ragwitz\ \<rafl\@debian\.org\>',
ABSTRACT => 'read-eval-print-loop for debugging your Catalyst application',
VERSION => '0.01',
AUTHOR => 'Tomas\ Doran\ \<bobtfish\@bobtfish\.net\>\,\ Florian\ Ragwitz\ \<rafl\@debian\.org\>\,\ Ash\ Berlin\ \<ash\@cpan\.org\>',
ABSTRACT => 'read\-eval\-print\-loop\ for\ debugging\ your\ Catalyst\ application',
VERSION => '0.04',
EXE_FILES => [ qw() ],
(eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
(eval { ExtUtils::MakeMaker->VERSION(6.31) } ? (LICENSE => 'perl') : ()),
PREREQ_PM => {
"namespace::clean" => '0',
"namespace::autoclean" => '0',
"Catalyst" => '5.800006',
"Carp::REPL" => '0',
},

4
README
View File

@@ -1,12 +1,12 @@
This archive contains the distribution CatalystX-REPL, version
0.01:
0.04:
read-eval-print-loop for debugging your Catalyst application
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
the same terms as perl itself.
the same terms as the Perl 5 programming language system itself.

View File

@@ -1,12 +1,13 @@
name = CatalystX-REPL
version = 0.01
author = Tomas Doram <bobtfish@bobtfish.net>
version = 0.04
author = Tomas Doran <bobtfish@bobtfish.net>
author = Florian Ragwitz <rafl@debian.org>
author = Ash Berlin <ash@cpan.org>
license = Perl_5
copyright_holder = Florian Ragwitz
[Prereq]
namespace::clean = 0
namespace::autoclean = 0
Carp::REPL = 0
Catalyst = 5.800006
@@ -15,4 +16,4 @@ bundle = @Classic
remove = PodVersion
remove = BumpVersion
[PodWeaver]
[PodPurler]

View File

@@ -1,5 +1,5 @@
package CatalystX::REPL;
our $VERSION = '0.01';
our $VERSION = '0.04';
# ABSTRACT: read-eval-print-loop for debugging your Catalyst application
@@ -7,25 +7,40 @@ use Moose::Role;
use Carp::REPL ();
use Catalyst::Utils;
use namespace::clean -except => 'meta';
use namespace::autoclean;
after setup_finalize => sub {
# Normally we'd hook into setup_finalize, but unfortunately for us Class::MOP
# localizes $SIG{__DIE__}, which Carp::REPL relies on, during load_class. That
# way the die handler will only be set up between between finishing setup and
# until after the run time of MyApp.pm ends, when MyApp is loaded with
# load_class, which it often is, for example in Catalyst::Test. Because of that
# we hook in at the start of each request and install our handler. This isn't
# too bad. After all, we're a debugging only tool. We could play some tricks to
# do this only once, before the first request and avoid reinstalling the
# handler on every subsequent request, but given we're a role, and we don't
# have a MyApp instance to store attributes in, we don't even try.
before prepare => sub {
my ($self) = @_;
$SIG{__DIE__} = \&Carp::REPL::repl
if Catalyst::Utils::env_value($self, 'repl');
if (my $repl_options = Catalyst::Utils::env_value($self, 'repl')) {
Carp::REPL->import(split q{,}, $repl_options);
}
};
1;
__END__
=pod
=head1 NAME
CatalystX::REPL - read-eval-print-loop for debugging your Catalyst application
=head1 VERSION
version 0.01
version 0.04
=head1 SYNOPSIS
@@ -33,6 +48,7 @@ version 0.01
use Moose;
# Requires Catalyst 5.8 series
extends 'Catalyst';
with 'CatalystX::REPL';
@@ -42,18 +58,61 @@ version 0.01
=head1 DESCRIPTION
This role automatically sets up Carp::REPL after starting your application, if
the C<CATALYST_REPL> or C<MYAPP_REPL> environment variabeles are set.
Using L<Carp::REPL|Carp::REPL> with a Catalyst application is hard. That's
because of all the internal exceptions that are being thrown and caught by
Catalyst during application startup. You'd have to manually skip over all of
those.
This role works around that by automatically setting up Carp::REPL after
starting your application, if the C<CATALYST_REPL> or C<MYAPP_REPL> environment
variables are set:
MYAPP_REPL=1 ./script/myapp_server.pl
# Hit an action
...
42 at lib/MyApp/Controller/Foo.pm line 8.
# instead of exiting, you get a REPL!
Trace begun at lib/MyApp/Controller/Foo.pm line 8
MyApp::Controller::Foo::bar('MyApp::Controller::Foo=HASH(0xc9fe20)', 'MyApp=HASH(0xcea6a4)') called at ...
... # Many more lines of stack trace
$ $c
MyApp=HASH(0xcea6ec)
$ $c->req->uri
http://localhost/foo/bar
$
Options like C<warn> or C<nodie> can be passed to Carp::REPL by putting them,
seperated by commas, into the environment variable:
MYAPP_REPL=warn,nodie ./script/myapp_server.pl
Carp::REPL uses L<Devel::REPL> for the shell, so direct any questions how how
to use or customize the repl at that module.
=head1 SEE ALSO
L<Carp::REPL>
L<Devel::REPL>
=head1 AUTHORS
Tomas Doram <bobtfish@bobtfish.net>
Tomas Doran <bobtfish@bobtfish.net>
Florian Ragwitz <rafl@debian.org>
Ash Berlin <ash@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
the same terms as perl itself.
the same terms as the Perl 5 programming language system itself.
=cut

View File

@@ -1,5 +1,5 @@
package TestApp;
our $VERSION = '0.01';
our $VERSION = '0.04';
use Moose;

View File

@@ -1,5 +1,5 @@
package TestApp::Controller::Foo;
our $VERSION = '0.01';
our $VERSION = '0.04';
use Moose;

21
t/release-pod-coverage.t Normal file
View File

@@ -0,0 +1,21 @@
#!perl
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
use Test::More;
eval "use Test::Pod::Coverage 1.08";
plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
if $@;
eval "use Pod::Coverage::TrustPod";
plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
if $@;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });

15
t/release-pod-syntax.t Normal file
View File

@@ -0,0 +1,15 @@
#!perl
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();

View File

@@ -1,13 +1,11 @@
use strict;
use warnings;
BEGIN { @ENV{qw/CATALYST_DEBUG CATALYST_REPL/} = (1, 1); }
BEGIN { @ENV{qw/CATALYST_REPL/} = 'noprofile'; }
use FindBin;
use lib "$FindBin::Bin/lib";
use Catalyst::Test 'TestApp';
$Carp::REPL::noprofile = 1;
request($ARGV[0]);