aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Ping903/Command/ident.pm
blob: 67cebd9402c8ed814cbf44dc1a93a3b21c674f84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package App::Ping903::Command::ident;
use strict;
use warnings;
use parent 'App::Ping903::Command';
use App::Ping903::Command ':exit_codes';

sub run {
    my $self = shift;
    $self->SUPER::run;
    $self->usage_error("extra parameters") if @ARGV > 1;

    my $id = $self->agent->get_id(@ARGV);
    unless ($id) {
	$self->abend(EX_FAIL, $self->agent->error_message);
    }

    foreach my $kw (sort keys %$id) {
	my $val = $id->{$kw} or next;
	print "$kw ";
	if (ref($val) eq 'ARRAY') {
	    print join(' ', @$val);
	} elsif (JSON::is_bool($val)) {
	    print $val ? "on" : "off";
	} else {
	    print $val
	}
	print "\n";
    }
}

1;

=head1 NAME

ident - display ping903 server identification

=head1 SYNOPSIS

B<ident>    
[I<PARAM>]

=head1 DESCRIPTION

Queries the running instance of B<ping903> about identification parameters
and prints them on screen.  The identification parameters are: package name,
package version an running instance PID.

If given a single argument I<PARAM>, only the requested parameter is
displayed.    

=head1 OPTIONS
    
=head2 Informative options

=over 4

=item B<-?>

Display short help summary.

=item B<--usage>

Display command line usage summary.

=item B<--help>

Display a detailed program manual.

=back

=head1 SEE ALSO

L<ping903>(1), L<ping903.conf>(5).

Return to:

Send suggestions and report system problems to the System administrator.