blib/lib/MYDan/Agent.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
run
2.0
BEGIN
2.0
CRAP 2.0
1 package MYDan::Agent;
2  
3 =head1 NAME
4  
5 Agent - A plugin execution platform
6  
7 =head1 SYNOPSIS
8  
9 use MYDan::Agent;
10  
11 my $agent = MYDan::Agent->new( '/path/file' );
12  
13 $agent->run();
14  
15 =cut
16 use strict;
17 use warnings;
18  
19 use MYDan::Agent::Path;
20 use MYDan::Agent::Query;
21  
22 sub new
23 {
24 my $class = shift;
25 bless { path => MYDan::Agent::Path->new( @_ )->make() }, ref $class || $class;
26 }
27  
28 =head1 METHODS
29  
30 =head3 run()
31  
32 Loads I<query> from STDIN, runs query, and dumps result in YAML to STDOUT.
33  
34 See MYDan::Agent::Query.
35  
36 =cut
37 sub run
38 {
39 local $| = 1;
40 local $/ = undef;
41  
42 my $self = shift;
43 warn sprintf "%s:%s\n", @ENV{ qw( TCPREMOTEIP TCPREMOTEPORT ) };
44  
45 my $query = MYDan::Agent::Query->load( <> );
46 warn $query->yaml();
47  
48 $query->run( %{ $self->{path}->path() } );
49 }
50  
51 1;