File Coverage

blib/lib/Mojolicious/Plugin/ReplyTime.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 13 13 100.0


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::ReplyTime;
2 1     1   703 use Mojo::Base 'Mojolicious::Plugin';
  1         3  
  1         7  
3              
4             our $VERSION = '0.02';
5              
6             sub register {
7 1     1 1 41 my ($self, $app) = @_;
8              
9             $app->helper('reply.time' => sub {
10             shift->respond_to(
11 2     2   16417 html => {text => scalar localtime},
12             json => {json => {time => scalar localtime}},
13             );
14 1         10 });
15             $app->routes->get('/replytime')->to(cb => sub {
16             shift->reply->time
17 1     1   532 });
  1         10503  
18             }
19              
20             1;
21             __END__