1CatalystX::REPL(3) User Contributed Perl Documentation CatalystX::REPL(3)
2
3
4
6 CatalystX::REPL - read-eval-print-loop for debugging your Catalyst
7 application
8
10 version 0.04
11
13 package MyApp;
14
15 use Moose;
16
17 # Requires Catalyst 5.8 series
18 extends 'Catalyst';
19 with 'CatalystX::REPL';
20
21 __PACKAGE__->setup(qw/-Debug/);
22
23 1;
24
26 Using Carp::REPL with a Catalyst application is hard. That's because of
27 all the internal exceptions that are being thrown and caught by
28 Catalyst during application startup. You'd have to manually skip over
29 all of those.
30
31 This role works around that by automatically setting up Carp::REPL
32 after starting your application, if the "CATALYST_REPL" or "MYAPP_REPL"
33 environment variables are set:
34
35 MYAPP_REPL=1 ./script/myapp_server.pl
36 # Hit an action
37 ...
38
39 42 at lib/MyApp/Controller/Foo.pm line 8.
40
41 # instead of exiting, you get a REPL!
42 Trace begun at lib/MyApp/Controller/Foo.pm line 8
43 MyApp::Controller::Foo::bar('MyApp::Controller::Foo=HASH(0xc9fe20)', 'MyApp=HASH(0xcea6a4)') called at ...
44 ... # Many more lines of stack trace
45
46 $ $c
47 MyApp=HASH(0xcea6ec)
48 $ $c->req->uri
49 http://localhost/foo/bar
50 $
51
52 Options like "warn" or "nodie" can be passed to Carp::REPL by putting
53 them, seperated by commas, into the environment variable:
54
55 MYAPP_REPL=warn,nodie ./script/myapp_server.pl
56
57 Carp::REPL uses Devel::REPL for the shell, so direct any questions how
58 how to use or customize the repl at that module.
59
61 Carp::REPL
62
63 Devel::REPL
64
66 Tomas Doran <bobtfish@bobtfish.net>
67 Florian Ragwitz <rafl@debian.org>
68 Ash Berlin <ash@cpan.org>
69
71 This software is copyright (c) 2009 by Florian Ragwitz.
72
73 This is free software; you can redistribute it and/or modify it under
74 the same terms as the Perl 5 programming language system itself.
75
76
77
78perl v5.32.1 2021-01-26 CatalystX::REPL(3)