remove WebGUI::Utility::isBetween
This commit is contained in:
parent
a34f51a903
commit
631c4fe38c
3 changed files with 4 additions and 44 deletions
|
|
@ -1013,7 +1013,9 @@ sub setRank {
|
|||
next;
|
||||
}
|
||||
last unless $sibling;
|
||||
if (isBetween($sibling->getRank, $newRank, $currentRank)) {
|
||||
my $rank = $sibling->getRank;
|
||||
if ($rank >= $newRank && $rank <= $currentRank
|
||||
|| $rank >= $currentRank && $rank <= $newRank) {
|
||||
$outputSub->('moving %s', $sibling->getTitle);
|
||||
$sibling->cascadeLineage($previous);
|
||||
$previous = $sibling->lineage;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Tie::IxHash;
|
|||
use Net::CIDR::Lite;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&isBetween &makeTabSafe &makeArrayTabSafe &randomizeHash &randomizeArray &isInSubnet
|
||||
our @EXPORT = qw(&makeTabSafe &makeArrayTabSafe &randomizeHash &randomizeArray &isInSubnet
|
||||
&sortHashDescending &sortHash &isIn &makeCommaSafe &makeArrayCommaSafe &randint &round &scalarEquals
|
||||
);
|
||||
|
||||
|
|
@ -38,7 +38,6 @@ This package provides miscellaneous but useful utilities to the WebGUI programme
|
|||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::Utility;
|
||||
$boolean = isBetween($value, $first, $second);
|
||||
$boolean = isIn($value, @array);
|
||||
$boolean = isInSubnet($ip, \@subnets);
|
||||
makeArrayCommaSafe(\@array);
|
||||
|
|
@ -59,39 +58,6 @@ These subroutines are available from this package:
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isBetween ( value, first, second )
|
||||
|
||||
Returns true if value is between two other values (inclusive). Otherwise returns false.
|
||||
|
||||
=head3 value
|
||||
|
||||
An integer to compare against first and second.
|
||||
|
||||
=head3 first
|
||||
|
||||
An integer to compare value against.
|
||||
|
||||
=head3 second
|
||||
|
||||
Another integer to compare value against.
|
||||
|
||||
=cut
|
||||
|
||||
sub isBetween {
|
||||
my $value = shift;
|
||||
my $first = shift;
|
||||
my $second = shift;
|
||||
if ($first > $second) {
|
||||
($first,$second) = ($second,$first);
|
||||
}
|
||||
if ($value >= $first && $value <= $second) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isIn ( value, list )
|
||||
|
||||
Returns a boolean value as to whether the value is in the array.
|
||||
|
|
|
|||
|
|
@ -22,14 +22,6 @@ use Test::Deep;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# isBetween
|
||||
ok(WebGUI::Utility::isBetween(0,-1,1), 'isBetween() - negative and positive range');
|
||||
ok(WebGUI::Utility::isBetween(0,1,-1), 'isBetween() - negative and positive range, reversed');
|
||||
ok(WebGUI::Utility::isBetween(11,1,15), 'isBetween() - positive range');
|
||||
ok(WebGUI::Utility::isBetween(-5,-10,-2), 'isBetween() - negative range');
|
||||
ok(!WebGUI::Utility::isBetween(+5,-10,-2), 'isBetween() - not in range on high side');
|
||||
ok(!WebGUI::Utility::isBetween(-15,-10,-2), 'isBetween() - not in range on low side');
|
||||
|
||||
# isIn
|
||||
ok(WebGUI::Utility::isIn("webgui", qw(cars trucks webgui trains)), 'isIn()');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue