Nicholas Perez > Catalyst-TraitFor-Controller-Ping-0.001 > Catalyst::TraitFor::Controller::Ping

Download:
Catalyst-TraitFor-Controller-Ping-0.001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.001   Source  

NAME ^

Catalyst::TraitFor::Controller::Ping - Provides a ping action for consuming controllers

VERSION ^

version 0.001

SYNOPSIS ^

 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 /],
    }
 );

 ...

DESCRIPTION ^

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.

PUBLIC_ATTRIBUTES ^

model_name

 isa: Str, is: ro

Define a model name to access via $c->model();

model_method

 isa: Str, is: ro

Define a method name to call upon the model

model_method_arguments

 isa: ArrayRef, is: ro

Define arguments to pass to the method upon the model

PUBLIC_METHODS ^

ping

 :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.

AUTHOR ^

  Nicholas Perez <nperez@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: