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