This is probably going to be better served as a command itself
git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@3851
bd8105ee-0ff8-0310-8827-fb3f25b6796d
--- /dev/null
+package Devel::REPL::Plugin::Timing;
+
+use Moose::Role;
+use Time::HiRes 'time';
+use namespace::clean -except => [ 'meta' ];
+
+around 'eval' => sub {
+ my $orig = shift;
+ my ($self, $line) = @_;
+
+ my @ret;
+ my $start = time;
+
+ if (wantarray) {
+ @ret = $self->$orig($line);
+ }
+ else {
+ $ret[0] = $self->$orig($line);
+ }
+
+ $self->print("Took " . (time - $start) . " seconds.\n");
+ return @ret;
+};
+
+1;
+