aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Ping903/Command/ident.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Ping903/Command/ident.pm')
-rw-r--r--lib/App/Ping903/Command/ident.pm54
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/App/Ping903/Command/ident.pm b/lib/App/Ping903/Command/ident.pm
new file mode 100644
index 0000000..d985f29
--- /dev/null
+++ b/lib/App/Ping903/Command/ident.pm
@@ -0,0 +1,54 @@
+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 SEE ALSO
+
+L<ping903>(1), L<ping903.conf>(5).
+

Return to:

Send suggestions and report system problems to the System administrator.