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