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:
parent
e7757648cc
commit
1355a4e8f9
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -365,7 +365,7 @@ sub parseLine{
|
|||
}
|
||||
$toreturn{'weight'}=$weight;
|
||||
|
||||
%toreturn{'args'}=\%args;
|
||||
$toreturn{'args'}=\%args;
|
||||
|
||||
return %toreturn;
|
||||
}
|
||||
|
|
|
@ -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" );
|
|
@ -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" );
|
|
@ -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" );
|
|
@ -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" );
|
|
@ -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" );
|
|
@ -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" );
|
|
@ -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" );
|
|
@ -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" );
|
Loading…
Reference in New Issue