SIGINT does not quit the REPL.
[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
3a400715 10sub BEFORE_PLUGIN {
11 my $self = shift;
12 $self->load_plugin('Turtles');
13}
1c4d0148 14
15sub 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
38Devel::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
52This L<Devel::REPL::Plugin> adds a C<peek> command that calls
53L<Devel::Peek/Dump> instead of the normal printing.
54
55=head1 SEE ALSO
56
57L<Devel::REPL>, L<Devel::Peek>
58
59=head1 AUTHOR
60
61Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt>
62
63=cut