misc. work add new checks

git-svn-id: svn://127.0.0.1/Perl/Chooser/trunk@886 0c1c3402-1be1-de11-8092-0022686faf23
This commit is contained in:
vvelox 2016-01-11 11:06:55 +00:00
parent e7757648cc
commit 1355a4e8f9
11 changed files with 100 additions and 8 deletions

View File

@ -3,6 +3,14 @@ MANIFEST
Makefile.PL
README
lib/Chooser.pm
lib/Chooser/Checks/defgateway.pm
lib/Chooser/Checks/cidr.pm
lib/Chooser/Checks/hostregex.pm
lib/Chooser/Checks/eval.pm
lib/Chooser/Checks/netidentflag.pm
lib/Chooser/Checks/pingmac.pm
lib/Chooser/Checks/sslcert.pm
lib/Chooser/Parse.pm
t/00-load.t
t/pod.t
bin/chooser

View File

@ -5,12 +5,19 @@ use strict;
use Text::NeatTemplate;
use Chooser::Parse;
use base 'Error::Helper';
use Sys::Hostname;
#process the value
sub valueProcess{
my $value=$_[0];
my $returned=$_[1];
my %vars=%{$_[2]};
my $self=$_[0];
my $value=$_[1];
my $returned=$_[2];
my %vars=%{$_[3]};
#blank any previous errors
if(!$self->errorblank){
return undef;
}
if (!$value =~ /^\%/){
return $value;
@ -120,12 +127,11 @@ never error.
=cut
sub new{
my $self={
error=>undef,
perror=>undef,
errorString=>undef,
cp=>Chooser::Parse->new;
cp=>Chooser::Parse->new,
};
bless $self;
@ -146,8 +152,15 @@ second is the choosen value. The third is the wieght of the returned value.
#parse and run a string
sub choose{
my $string=$_[1];
my $self=$_[0];
my $chooser=$_[1];
my $string=$_[2];
#blank any previous errors
if(!$self->errorblank){
return undef;
}
if (!defined($string)){
return (0, undef);
}
@ -160,7 +173,6 @@ sub choose{
my %vars;
#finds the heaviest value
my @keys=keys(%values);
my $keysInt=0;

View File

@ -365,7 +365,7 @@ sub parseLine{
}
$toreturn{'weight'}=$weight;
%toreturn{'args'}=\%args;
$toreturn{'args'}=\%args;
return %toreturn;
}

9
Chooser/t/01-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Parse' );
}
diag( "Testing Chooser::Parse $Chooser::Parse::VERSION, Perl $], $^X" );

9
Chooser/t/02-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::defgateway' );
}
diag( "Testing Chooser::Checks::defgateway $Chooser::Checks::defgateway::VERSION, Perl $], $^X" );

9
Chooser/t/03-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::cidr' );
}
diag( "Testing Chooser::Checks::cidr $Chooser::Checks::cidr::VERSION, Perl $], $^X" );

9
Chooser/t/04-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::hostregex' );
}
diag( "Testing Chooser::Checks::hostregex $Chooser::Checks::hostregex::VERSION, Perl $], $^X" );

9
Chooser/t/05-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::eval' );
}
diag( "Testing Chooser::Checks::eval $Chooser::Checks::eval::VERSION, Perl $], $^X" );

9
Chooser/t/06-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::netidentflag' );
}
diag( "Testing Chooser::Checks::netidentflag $Chooser::Checks::netidentflag::VERSION, Perl $], $^X" );

9
Chooser/t/07-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::pingmac' );
}
diag( "Testing Chooser::Checks::pingmac $Chooser::Checks::pingmac::VERSION, Perl $], $^X" );

9
Chooser/t/08-load.t Normal file
View File

@ -0,0 +1,9 @@
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'Chooser::Checks::sslcert' );
}
diag( "Testing Chooser::Checks::sslcert $Chooser::Checks::sslcert::VERSION, Perl $], $^X" );