| 1 | package Monitoring::Reporter::Web::Plugin::Selftest; | ||||||||||
| 2 | { | ||||||||||
| 3 | 1 | $Monitoring::Reporter::Web::Plugin::Selftest::VERSION = '0.01'; | |||||||||
| 4 | } | ||||||||||
| 5 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | $Monitoring::Reporter::Web::Plugin::Selftest::AUTHORITY = 'cpan:TEX'; | |||||||||
| 7 | } | ||||||||||
| 8 | # ABSTRACT: Monitoring Server Selftest | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use 5.010_000; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use mro 'c3'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use feature ':5.10'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | # use IO::Handle; | ||||||||||
| 18 | # use autodie; | ||||||||||
| 19 | # use MooseX::Params::Validate; | ||||||||||
| 20 | # use Carp; | ||||||||||
| 21 | # use English qw( -no_match_vars ); | ||||||||||
| 22 | # use Try::Tiny; | ||||||||||
| 23 | |||||||||||
| 24 | # extends ... | ||||||||||
| 25 | 1 | extends 'Monitoring::Reporter::Web::Plugin'; | |||||||||
| 26 | # has ... | ||||||||||
| 27 | # with ... | ||||||||||
| 28 | # initializers ... | ||||||||||
| 29 | 0 | ▶ | sub _init_fields { return [qw()]; } | ||||||||
|
Subroutine
_init_fields: not called CC=1 SCAR=6.9
| |||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub _init_alias { return 'healthcheck'; } | ||||||||
|
Subroutine
_init_alias: not called CC=1 SCAR=6.9
| |||||||||||
| 32 | |||||||||||
| 33 | # your code here ... | ||||||||||
| 34 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 35 | 0 | my $self = shift; | |||||||||
| 36 | 0 | my $request = shift; | |||||||||
| 37 | |||||||||||
| 38 | 0 | my ($ok, $msg_ref) = $self->mr()->selftest(); | |||||||||
| 39 | 0 | my $body = join("\n", @{$msg_ref}); | |||||||||
| 40 | 0 | my $status = 100; | |||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | if($ok) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | $body = join("\n", @{$msg_ref}); | |||||||||
| 44 | 0 | $status = 200; | |||||||||
| 45 | } else { | ||||||||||
| 46 | 0 | $status = 503; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 0 | return [ $status, [ | |||||||||
| 50 | 'Content-Type', 'text/plain', | ||||||||||
| 51 | 'Cache-Control', 'no-store, private', # no caching for the selftest | ||||||||||
| 52 | ], [$body] ]; | ||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 56 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 57 | |||||||||||
| 58 | 1 | 1; | |||||||||
| 59 | |||||||||||
| 60 | __END__ | ||||||||||