Commit | Line | Data |
1716b200 |
1 | use strict; |
2 | use warnings; |
1c4d0148 |
3 | package Devel::REPL::Plugin::Peek; |
9d2a4940 |
4 | # ABSTRACT: L<Devel::Peek> plugin for L<Devel::REPL>. |
1c4d0148 |
5 | |
5ac98890 |
6 | our $VERSION = '1.003028'; |
54beb05d |
7 | |
6f4f9516 |
8 | use Devel::REPL::Plugin; |
1c4d0148 |
9 | use Devel::Peek qw(Dump); |
aa8b7647 |
10 | use namespace::autoclean; |
1c4d0148 |
11 | |
3a400715 |
12 | sub BEFORE_PLUGIN { |
13 | my $self = shift; |
14 | $self->load_plugin('Turtles'); |
15 | } |
1c4d0148 |
16 | |
17 | sub expr_command_peek { |
18 | my ( $self, $eval, $code ) = @_; |
19 | |
213b6e76 |
20 | my @res = $self->eval($code); |
21 | |
22 | if ( $self->is_error(@res) ) { |
23 | return $self->format(@res); |
24 | } else { |
25 | # can't override output properly |
26 | # FIXME do some dup wizardry |
27 | Dump(@res); |
28 | return ""; # this is a hack to print nothing after Dump has already printed. PLZ TO FIX KTHX! |
29 | } |
1c4d0148 |
30 | } |
31 | |
32 | __PACKAGE__ |
33 | |
34 | __END__ |
35 | |
36 | =pod |
37 | |
1c4d0148 |
38 | =head1 SYNOPSIS |
39 | |
40 | repl> #peek "foo" |
41 | SV = PV(0xb3dba0) at 0xb4abc0 |
42 | REFCNT = 1 |
43 | FLAGS = (POK,READONLY,pPOK) |
44 | PV = 0x12bcf70 "foo"\0 |
45 | CUR = 3 |
46 | LEN = 4 |
47 | |
48 | =head1 DESCRIPTION |
49 | |
50 | This L<Devel::REPL::Plugin> adds a C<peek> command that calls |
51 | L<Devel::Peek/Dump> instead of the normal printing. |
52 | |
53 | =head1 SEE ALSO |
54 | |
55 | L<Devel::REPL>, L<Devel::Peek> |
56 | |
57 | =head1 AUTHOR |
58 | |
59 | Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt> |
60 | |
61 | =cut |