remove WebGUI::Utility::scalarEquals

This commit is contained in:
Graham Knop 2010-08-20 12:54:34 -05:00
parent a0a26da3bc
commit ff70751bc5
3 changed files with 4 additions and 64 deletions

View file

@ -23,7 +23,7 @@ use Net::CIDR::Lite;
our @ISA = qw(Exporter);
our @EXPORT = qw(&isInSubnet
&sortHash &isIn &randint &round &scalarEquals
&sortHash &isIn &randint &round
);
@ -164,32 +164,6 @@ sub round {
#-------------------------------------------------------------------
=head2 scalarEquals ( $a, $b, .. )
Checks an arbitrary number of scalars for strict equality.
Lets perl do all the work for us, via clever use of hash keys.
Credit goes to davido on perlmonks: http://www.perlmonks.org/?node_id=525349
Be aware that this may actually be more strict than you want. See Utility.t
for the full list of scalars that are considered equal and not equal.
=cut
sub scalarEquals {
# False when < 2 defined args
return 0 if ( grep { defined($_) } @_ ) < 2;
# Use args as hash keys, all equal if we end up with only 1 key
no warnings qw/uninitialized/;
my %gadget;
@gadget{@_} = ();
return scalar keys %gadget == 1 ? 1 : 0;
}
#-------------------------------------------------------------------
=head2 sortHash ( hash )
Sorts a hash by its values. Returns a Tie::IxHash. You must assign this to