From: Mike G. v. a. <we...@ma...> - 2010-05-14 12:39:10
|
Log Message: ----------- removed duplicate definition of not_null Modified Files: -------------- pg/macros: PGbasicmacros.pl Revision Data ------------- Index: PGbasicmacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGbasicmacros.pl,v retrieving revision 1.66 retrieving revision 1.67 diff -Lmacros/PGbasicmacros.pl -Lmacros/PGbasicmacros.pl -u -r1.66 -r1.67 --- macros/PGbasicmacros.pl +++ macros/PGbasicmacros.pl @@ -192,27 +192,27 @@ $r_ans_rule_count = PG_restricted_eval(q!\$ans_rule_count!); } -=head2 Utility Macros - - not_null(item) returns 1 or 0 - - empty arrays, empty hashes, strings containing only whitespace are all NULL and return 0 - all undefined quantities are null and return 0 - - -=cut - -sub not_null { # empty arrays, empty hashes and strings containing only whitespace are all NULL - my $item = shift; - return 0 unless defined($item); - if (ref($item)=~/ARRAY/) { - return scalar(@{$item}); # return the length - } elsif (ref($item)=~/HASH/) { - return scalar( keys %{$item}); - } else { # string case return 1 if none empty - return ($item =~ /\S/)? 1:0; - } -} +# =head2 Utility Macros +# +# not_null(item) returns 1 or 0 +# +# empty arrays, empty hashes, strings containing only whitespace are all NULL and return 0 +# all undefined quantities are null and return 0 +# +# +# =cut +# +# sub not_null { # empty arrays, empty hashes and strings containing only whitespace are all NULL +# my $item = shift; +# return 0 unless defined($item); +# if (ref($item)=~/ARRAY/) { +# return scalar(@{$item}); # return the length +# } elsif (ref($item)=~/HASH/) { +# return scalar( keys %{$item}); +# } else { # string case return 1 if none empty +# return ($item =~ /\S/)? 1:0; +# } +# } =head2 Answer blank macros: |