projects
/
MojoFacets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e262852
)
use before_dispatch plugin hook to audit requests
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 21 May 2010 14:09:44 +0000
(16:09 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 21 May 2010 14:09:44 +0000
(16:09 +0200)
lib/MojoFacets.pm
patch
|
blob
|
history
diff --git
a/lib/MojoFacets.pm
b/lib/MojoFacets.pm
index
f353f33
..
dd80788
100644
(file)
--- a/
lib/MojoFacets.pm
+++ b/
lib/MojoFacets.pm
@@
-7,6
+7,8
@@
our $VERSION = '0.0001';
use base 'Mojolicious';
use base 'Mojolicious';
+use Data::Dump qw(dump);
+
# This method will run once at server start
sub startup {
my $self = shift;
# This method will run once at server start
sub startup {
my $self = shift;
@@
-16,6
+18,19
@@
sub startup {
# Default route
$r->route('/:controller/:action/:id')->to('data#index', id => 1);
# Default route
$r->route('/:controller/:action/:id')->to('data#index', id => 1);
+
+# $self->plugin( 'request_timer' );
+
+ $self->plugins->add_hook(
+ before_dispatch => sub {
+ my ($self, $c) = @_;
+ my $tx = $c->tx;
+ # Do whatever you want with the transaction here
+ if ( $tx->req->url->query ) {
+ warn "# before_dispatch url ",dump($tx->req->url);
+ }
+ }
+ );
}
1;
}
1;