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