Sentinel/Api.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 27 CC 1 SCAR 6.9
CC
1
Cov
0%
capture_message
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Daje::Sentinel::Api;
2 use Mojo::Base -base;
3
4 use Daje::Utils::Factory::Collection qw{load_collection};
5 use POSIX qw(strftime);
6 use Try::Tiny;
7
8 our $VERSION = '0.12';
9
10 has 'mango';
11
12 sub capture_message{ # void($source, $method, $message)
13 my ($self, $source, $method, $message) = @_;
14
15 my $classname = load_collection("Sentinel");
16
17 my $result = try {
18 return $classname->new(
19 mango => $self->mango,
20 query => {
21 source => $source,
22 method => $method,
23 message => $message,
24 doc_updated => strftime ("%Y-%m-%d %H:%M:%S", localtime),
25 }
26 )->insert();
27 } catch {
28 say $_;
29 return $_;
30 };
31
32 return $result;
33 }
34
35 1;
36
37
38
39
40 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
41
42 =head1 NAME
43
44 Daje::Sentinel::Api
45
46
47 =head1 DESCRIPTION
48
49 pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
50
51
52 =head1 REQUIRES
53
54 L<Try::Tiny>
55
56 L<POSIX>
57
58 L<Daje::Utils::Factory::Collection>
59
60 L<Mojo::Base>
61
62
63 =head1 METHODS
64
65 =head2 capture_message
66
67 capture_message($source, $method, $message);
68
69
70 =cut
71