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