make ReadLineHistory history file location portable
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / Timing.pm
CommitLineData
296c23ff 1package Devel::REPL::Plugin::Timing;
2
6a5409bc 3use Devel::REPL::Plugin;
296c23ff 4use Time::HiRes 'time';
5use namespace::clean -except => [ 'meta' ];
6
7around 'eval' => sub {
8 my $orig = shift;
9 my ($self, $line) = @_;
10
11 my @ret;
12 my $start = time;
13
14 if (wantarray) {
15 @ret = $self->$orig($line);
16 }
17 else {
18 $ret[0] = $self->$orig($line);
19 }
20
21 $self->print("Took " . (time - $start) . " seconds.\n");
22 return @ret;
23};
24
251;
26
cfd1094b 27__END__
28
29=head1 NAME
30
31Devel::REPL::Plugin::Timing - display execution times
32
30b459d4 33=head1 AUTHOR
34
35Shawn M Moore, C<< <sartak at gmail dot com> >>
36
cfd1094b 37=cut
38