Fix various minor documentation issues in perl/t/critic.t

Change-Id: I0315925a72997fa99cbef48866516e8f907aeedf
Reviewed-on: https://gerrit.stanford.edu/770
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Switch Perl build system to Module::Build

The Net::Remctl Perl bindings now require Perl 5.8 or later (instead
of 5.006 in previous versions) and are now built with Module::Build
instead of ExtUtils::MakeMaker.  This should be transparent to anyone
not working with the source code, since Perl 5.8 was released in 2002,
but Module::Build and ExtUtils::CBuilder are now required to build
Net::Remctl.  They are included in Perl 5.10 or later and can be
installed separately for older versions of Perl.

Change-Id: Ifc54e38d7efcc01cab5f0ae3c89ebed8e748166a
Reviewed-on: https://gerrit.stanford.edu/771
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Update perltidy and perlcritic configuration

Synchronized with the latest version from rra-c-util.

Change-Id: I6da84380089cba7dee82e7596c35dd515393a4da
Reviewed-on: https://gerrit.stanford.edu/772
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Exempt Perl Build script from Perl strictness tests

This is automatically generated by Module::Build, which doesn't
use strict.  Exempt it from t/strict.t.

Change-Id: I7a179686571f639620a7dccf49899fc1a314fe87
Reviewed-on: https://gerrit.stanford.edu/773
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Update all Perl coding style for latest standard

Change-Id: I951011eeb964738269915aae7078cfaf27924ac1
Reviewed-on: https://gerrit.stanford.edu/774
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Reorganize Perl test suite

Modify the Perl test suite to use the same hierarchical organization
that I'm starting to use with all of my packages.  This makes it much
easier to configure, for example, which tests to skip for coverage
analysis.

Add some new Perl files to PERL_FILES in Makefile.am.

Change-Id: I97763730733d0f94035005b4f0ecef194a19085f
Reviewed-on: https://gerrit.stanford.edu/775
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Further relax perlcritic configuration for tests

Relax two more policies that we're not following in the official
Stanford coding style.

Change-Id: If06be01bad00e5d255c418481c674544c318afea
Reviewed-on: https://gerrit.stanford.edu/776
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Ignore perl/cover_db, created by coverage testing

Change-Id: I0f0b535b770884b69dab9eb6dfd12d1fbdb855bb
Reviewed-on: https://gerrit.stanford.edu/777
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Update various Perl tests to my latest version

Import new versions from Log::Stream and update them somewhat more.
Eventually I will converge on standard tests.

Change-Id: I3c4b5ddc7264e3246f31be5a09e69181c1978535
Reviewed-on: https://gerrit.stanford.edu/778
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Avoid trailing whitespace in Net::Remctl::Backend help

When there is no syntax or summary for a command, we generated
trailing whitespace for that line.  Rework the code to avoid that,
and also update for the current Stanford coding style.

Change-Id: Id8584df02437017f56e0e6eb55f43050d8abbbd3
Reviewed-on: https://gerrit.stanford.edu/779
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Flesh out Net::Remctl::Backend tests

We now have 100% code coverage in the test suite (although this can't
measure code coverage in the XS module).

Change-Id: I1be4021c98a1275cafdd79a6530ae5bdf186dd88
Reviewed-on: https://gerrit.stanford.edu/780
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Make Perl test suite self-contained

Copy the key bits from the main test suite into the Perl test suite,
either in the distribution or, for test configuration, dynamically on
make check.  Eliminate the need for Autoconf substitution in the API
check by passing in the path to the remctld as an environment variable.
This means that it's now meaningful to create a standalone Perl
distribution of Net::Remctl.

Change-Id: I71def2b71e9da832e7af042c899ebb37ab18df5d
Reviewed-on: https://gerrit.stanford.edu/781
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add coverage testing to the Perl test suite

Change-Id: I31fcc9b44ad05203887aa33d098da1e2f88aa348
Reviewed-on: https://gerrit.stanford.edu/782
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add Net::Remctl::Backend support for min_args

Allow specifying the minimum number of arguments to a function and
dying if there are insufficient arguments.

Change-Id: Iaef37a8302fc68760a6bdc1ee709e11597d8dc7d
Reviewed-on: https://gerrit.stanford.edu/796
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add Net::Remctl::Backend support for max_args

Add support for specifying the maximum number of arguments to a
command and throwing an error if more arguments were passed.

Change-Id: I121c69ebb528f77f6b258b15cdb158bd1304b2ab
Reviewed-on: https://gerrit.stanford.edu/797
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add command name to Net::Remctl::Backend errors

If the global command name is configured in the Net::Remctl::Backend
object, add it to the prefix of errors that are reported by run().
This should make things a bit friendlier.

Change-Id: Ib30178ee50bd4fdccde7898baa5aa89be1fa24b4
Reviewed-on: https://gerrit.stanford.edu/798
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add Net::Remctl::Backend support for argument validation

Add a new args_match parameter that configures regexes to match the
arguments of a command.  Also rename max_args to args_max and
min_args to args_min for consistency.

Change-Id: Icb01d3b8c4bbe0f8610e2dded8617147d95fdf62
Reviewed-on: https://gerrit.stanford.edu/799
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Move connection-opening to remctl_open()

Take code that selects a port and calls internal_connect() to establish
a connection, and pull it up out of internal_open() and into remctl_open().
In the process, internal_connect() is made non-static, and internal_open()
loses its port argument.

This paves the way for alternatives to remctl_open() in which the caller
provides a socket descriptor or address instead of a hostname and port.
Such interfaces will need internal_open() without internal_connect().

Change-Id: I81d90097a3d422fb9c6a3fe754a5a1f60aac4415
Reviewed-on: https://gerrit.stanford.edu/806
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Abstract out connection reset before open

remctl_open() performs certain operations to "reset" a connection before
opening it.  These have now been abstracted out into a new internal_reset()
in order to allow them to be shared between multiple open interfaces.

Change-Id: Ie309f288dd2e52d82e71bcb2e9dc74320515dab5
Reviewed-on: https://gerrit.stanford.edu/807
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add alternate remctl_open API's

Add new APIs for establishing a remctl connection given a sockaddr,
a list of struct addrinfo, or an already-open socket.

Change-Id: I300b16023b989fdd97cb6e6695a92203a8937da2
Reviewed-on: https://gerrit.stanford.edu/813
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>