examples/test-server
changeset 14 7ccc679ac5db
parent 13 d6f681329542
child 15 2d41fac09084
--- a/examples/test-server	Sun Jan 04 23:44:45 2009 +0100
+++ b/examples/test-server	Mon Jan 05 21:44:56 2009 +0100
@@ -8,9 +8,64 @@
 use warnings;
 use POSIX qw(tmpnam);
 use Getopt::Long;
+use Pod::Usage;
 use Quancom::Test::Server;
 
 $SIG{INT} = sub { warn "got INT, exit now\n"; exit 0; };
 
+GetOptions(
+    "help" => sub { pod2usage(-verbose => 0, exit => 0) },
+    "man"  => sub { pod2usage(-verbose => 2, exit => 0) },
+) or pod2usage;
+
 my $server = new Quancom::Test::Server @ARGV ? $ARGV[0] : tmpnam();
 $server->run;
+
+__END__
+
+=head1 NAME
+
+test-server
+
+=head1 SYNOPSIS
+
+    test-server [socket|[address:]port|-]
+
+=head1 DESCRIPTION
+
+This command starts a test server simulating a Quancom USB-OPTO device.
+It's use is for testing purpose only (testing the Quancom.pm module).
+
+=head1 INVOCATION
+
+On invocation you may pass a parameter:
+
+=over
+
+=item I<socket>
+
+This should be the name of a socket file. The socket file must not
+exist, it will be created. The name has contain at least on slash ("/")
+to be distinguished from a port number.
+
+=item [I<address:>]I<port>
+
+Using this the server will bind to the specified port on 0.0.0.0 or the 
+address supplied.
+
+=item B<->
+
+Using a single "-" the server will communicate over STDIN/STDOUT. Some
+changes in behaviour are implicit set. See L<Quancom::Test::Server> for
+more details. This option is for testing the test server.
+
+=item B<no parameter at all>
+
+If you do not pass anything, the server creates a temporary socket file.
+
+=back
+
+In all cases, the server tells you on STDERR about the "channel" used
+for communication.
+
+=cut