Catalyst::TraitFor::Controller::Ping - Provides a ping action for consuming controllers
version 0.001
package MyApp::Controller::Foo; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller' } with 'Catalyst::TraitFor::Controller::Ping'; __PACKAGE__->config ( { model_name => 'SomeModel', model_method => 'some_method', model_method_arguments => [qw/ one two three /], } ); ...
Ever wanted to monitor a web app? With this simple role, you can easily add an action to "ping" to test if the app is up and running. You can even define a "model_name" and a "model_method" to call so it perihperally tests the app's connection to the database (or some other resource). Simply add exceptions for "ping" in your ACL, and you're good to go.
isa: Str, is: ro
Define a model name to access via $c->model();
Define a method name to call upon the model
isa: ArrayRef, is: ro
Define arguments to pass to the method upon the model
:Local
ping is an action added to which ever controller consumes this role that simply returns. If a "model_name" is configured, the model will be gathered via $c->model(). If "model_method" is configured, that method will be called upon the retrived model. If "model_method_arguments" are provided, they will be passed to the model method. The return value is discarded. Only that the method executed without exception matters for ping. Ping will return no content so it doesn't forward to views or anything else.
Nicholas Perez <nperez@cpan.org>
This software is copyright (c) 2010 by Infinity Interactive, Inc..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::TraitFor::Controller::Ping, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::TraitFor::Controller::Ping
CPAN shell
perl -MCPAN -e shell install Catalyst::TraitFor::Controller::Ping
For more information on module installation, please visit the detailed CPAN module installation guide.