From a4b605da3067cd54be57ef715eee15cbb8f9f198 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Wed, 1 May 2019 02:34:30 -0500 Subject: [PATCH] add the start of the bin and various bits to the makefile.pl --- VM-CBSD-Poller/Makefile.PL | 45 ++++++++++++++++---------------- VM-CBSD-Poller/bin/poll_cbsd_vm | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 22 deletions(-) create mode 100644 VM-CBSD-Poller/bin/poll_cbsd_vm diff --git a/VM-CBSD-Poller/Makefile.PL b/VM-CBSD-Poller/Makefile.PL index 03a2a6b..1280362 100644 --- a/VM-CBSD-Poller/Makefile.PL +++ b/VM-CBSD-Poller/Makefile.PL @@ -4,25 +4,26 @@ use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( - NAME => 'VM::CBSD::Poller', - AUTHOR => q{Zane C. Bowers-Hadley }, - VERSION_FROM => 'lib/VM/CBSD/Poller.pm', - ABSTRACT_FROM => 'lib/VM/CBSD/Poller.pm', - LICENSE => 'artistic_2', - MIN_PERL_VERSION => '5.006', - CONFIGURE_REQUIRES => { - 'ExtUtils::MakeMaker' => '0', - }, - TEST_REQUIRES => { - 'Test::More' => '0', - }, - PREREQ_PM => { - #'ABC' => '1.6', - #'Foo::Bar::Module' => '5.0401', - }, - dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, - clean => { FILES => 'VM-CBSD-Poller-*' }, -); + NAME => 'VM::CBSD::Poller', + AUTHOR => q{Zane C. Bowers-Hadley }, + VERSION_FROM => 'lib/VM/CBSD/Poller.pm', + ABSTRACT_FROM => 'lib/VM/CBSD/Poller.pm', + LICENSE => 'artistic_2', + MIN_PERL_VERSION => '5.006', + INST_SCRIPT => 'bin', + CONFIGURE_REQUIRES => { + 'ExtUtils::MakeMaker' => '0', + }, + TEST_REQUIRES => { + 'Test::More' => '0', + }, + PREREQ_PM => { + 'JSON'=>'2.97.001', + 'Error::Helper'=>'1.0.0', + }, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'VM-CBSD-Poller-*' }, + ); # Compatibility with old versions of ExtUtils::MakeMaker unless (eval { ExtUtils::MakeMaker->VERSION('6.64'); 1 }) { @@ -36,10 +37,10 @@ unless (eval { ExtUtils::MakeMaker->VERSION('6.55_03'); 1 }) { } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} - unless eval { ExtUtils::MakeMaker->VERSION('6.52'); 1 }; +unless eval { ExtUtils::MakeMaker->VERSION('6.52'); 1 }; delete $WriteMakefileArgs{MIN_PERL_VERSION} - unless eval { ExtUtils::MakeMaker->VERSION('6.48'); 1 }; +unless eval { ExtUtils::MakeMaker->VERSION('6.48'); 1 }; delete $WriteMakefileArgs{LICENSE} - unless eval { ExtUtils::MakeMaker->VERSION('6.31'); 1 }; +unless eval { ExtUtils::MakeMaker->VERSION('6.31'); 1 }; WriteMakefile(%WriteMakefileArgs); diff --git a/VM-CBSD-Poller/bin/poll_cbsd_vm b/VM-CBSD-Poller/bin/poll_cbsd_vm new file mode 100644 index 0000000..5614199 --- /dev/null +++ b/VM-CBSD-Poller/bin/poll_cbsd_vm @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Getopt::Long; +use Device::RAID::Poller; +use JSON; + +sub version{ + print "check_raid v. 0.0.0\n"; +} + +sub help{ + &version; + + print ' + +-p Print the JSON in a pretty format. +'; +} + +# command line option holders +my $help=0; +my $version=0; +my $pretty=0; + +# get the commandline options +Getopt::Long::Configure ('no_ignore_case'); +Getopt::Long::Configure ('bundling'); +GetOptions( + 'version' => \$version, + 'v' => \$version, + 'help' => \$help, + 'h' => \$help, + 'p' => \$pretty, + ); + +# print version or help if requested +if ( $help ){ + &help; + exit 42; +} +if ( $version ){ + &version; + exit 42; +}