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