use Getopt::Long qw(GetOptions);
use Pod::Usage qw(pod2usage);
my %opt = (
device => "/dev/ttyUSB0",
...
);
GetOptions (
\%opt,
'device=s',
...
) or pod2usage(-exitval => 1, -verbose => 0);
pod2usage(-exitstatus => 0, -verbose => 2) if $opt{help};
...
=head1 NAME
=head1 SYNOPSIS
vp2 [options]
Options:
--help Display detailed help message
--model Display the console model
--version Display the console version number
--imperial Use imperial rather than metric units
--gettime Get the time from the console and display it
--settime Set console time to match current localtime
--backlight=<on|off> Turn the console backlight on or off
--interval=<n> Set the archive period to <n> minutes, where <n>
is one of 1, 5, 10, 15, 20, 30, 60 or 120
...
=head1 DESCRIPTION
=head1 EXAMPLES
vp2 --model --version --gettime