6 our $VERSION = '0.0001';
8 use base 'Mojolicious';
10 use Data::Dump qw(dump);
12 use Time::HiRes qw(time);
17 # warn "## before_dispatch req ",dump($tx->req->url, $tx->req->params);
18 my $path = $self->req->url->path;
19 if ( $path =~ m{/data/} ) {
20 if ( my $params = $self->req->params ) {
23 if ( my $time_travel = $params->param('time') ) {
24 warn "# time-travel to $time_travel\n";
28 my $actions_path = '/tmp/actions/';
29 mkdir $actions_path unless -e $actions_path;
31 $actions_path .= sprintf '%.4f%s', $time, $path;
33 my $hash = $params->to_hash;
35 store $hash, $actions_path;
36 warn "SAVE $actions_path ", -s $actions_path, " bytes params = ", dump($hash), $/;
42 # This method will run once at server start
47 my $r = $self->routes;
50 $r->route('/:controller/:action/:id')->to('data#index', id => 0);
52 # $self->plugin( 'request_timer' );
55 after_dispatch => sub {
61 eval 'use MojoFacets::Plugin::NYTProf';
63 warn "profile disabled: ",substr($@,0,40) if $@;
65 MojoFacets::Plugin::NYTProf->register( $self );