[Mojolicious] url recorder for audit log

26 views
Skip to first unread message

Dobrica Pavlinusic

unread,
May 21, 2010, 5:58:23 AM5/21/10
to Mojolicious
I'm creating server-side facet browsing using Mojolicious and jQuery
UI

http://github.com/dpavlin/mojo_facets

I would like to add audit log which would record all URL requests and
allow undo/redo and persistence using that data.

Extending Mojolicious::Controller seems like logical step, but I can't
find obvious way to do it. Is there a better way to do this?

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to mojol...@googlegroups.com.
To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.

Sebastian Riedel

unread,
May 21, 2010, 6:11:26 AM5/21/10
to mojol...@googlegroups.com
> I'm creating server-side facet browsing using Mojolicious and jQuery
> UI
>
> http://github.com/dpavlin/mojo_facets
>
> I would like to add audit log which would record all URL requests and
> allow undo/redo and persistence using that data.
>
> Extending Mojolicious::Controller seems like logical step, but I can't
> find obvious way to do it. Is there a better way to do this?

Sounds like you might want to use the plugin API, here's an example using hooks.

$app->plugins->add_hook(
before_dispatch => sub {
my ($self, $c) = @_;
my $tx = $c->tx;
# Do whatever you want with the transaction here
}
);

And a full plugin example.

http://github.com/kraih/mojo/blob/master/lib/Mojolicious/Plugin/RequestTimer.pm

--
Sebastian Riedel
http://labs.kraih.com
http://mojolicious.org
http://twitter.com/kraih
Reply all
Reply to author
Forward
0 new messages