[interchange-cvs] interchange - kwalsh modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Nov 6 05:58:26 EST 2007


User:      kwalsh
Date:      2007-11-06 10:58:26 GMT
Modified:  lib/Vend Interpolate.pm
Modified:  .        WHATSNEW-5.5
Log:
    * Further to the previous patch.  It seemed a bit silly to keep the
      random=0 backward compatibility when all of the other rules were
      thrown out of the window, so random=0 is now the same as random=no
      (return all of the original rows in their original order).

Revision  Changes    Path
2.290     +7 -5      interchange/lib/Vend/Interpolate.pm


rev 2.290, prev_rev 2.289
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.289
retrieving revision 2.290
diff -u -r2.289 -r2.290
--- Interpolate.pm	6 Nov 2007 10:20:38 -0000	2.289
+++ Interpolate.pm	6 Nov 2007 10:58:26 -0000	2.290
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.289 2007/11/06 10:20:38 kwalsh Exp $
+# $Id: Interpolate.pm,v 2.290 2007/11/06 10:58:26 kwalsh Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.289 $, 10);
+$VERSION = substr(q$Revision: 2.290 $, 10);
 
 @EXPORT = qw (
 
@@ -3520,8 +3520,10 @@
 
 sub random_elements {
 	my($ary, $wanted) = @_;
-	$wanted = 1 if ! $wanted || $wanted =~ /\D/;
+	return (0 .. $#$ary) unless $wanted > 0;
+	$wanted = 1 if $wanted =~ /\D/;
 	return undef unless ref $ary;
+
 	my %seen;
 	my ($j, @out);
 	my $count = scalar @$ary;
@@ -3582,8 +3584,8 @@
 	if (defined $obj->{more_in_progress} and $obj->{mv_first_match}) {
 		$i = $obj->{mv_first_match};
 	}
-	elsif (defined $opt->{random} && $opt->{random} !~ /^[nf]/i) {
-		$opt->{random} = scalar(@$ary) if $opt->{random} =~ /^[yt]/i;
+	elsif (defined $opt->{random} && !is_no($opt->{random})) {
+		$opt->{random} = scalar(@$ary) if $opt->{random} =~ /^[yYtT]/;
 		@$ary = @$ary[random_elements($ary, $opt->{random})];
 		$i = 0; $end = $#$ary;
 		undef $obj->{mv_matchlimit};



1.67      +2 -4      interchange/WHATSNEW-5.5


rev 1.67, prev_rev 1.66
Index: WHATSNEW-5.5
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.5,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- WHATSNEW-5.5	6 Nov 2007 10:20:39 -0000	1.66
+++ WHATSNEW-5.5	6 Nov 2007 10:58:26 -0000	1.67
@@ -14,15 +14,13 @@
 
 * Fix to the "random" parameter used by looping tags.
 
-	-- If set to "no" or "false" then do nothing (previously returned
-	   one random result).
+	-- If set to "no" or "false" or "0" then return all of the results
+	   their original order (previously returned one random result).
 
 	-- If set to "yes" or "true" then then return all results in a
 	   random order (again, previously returned one random result).
 	   
 	-- If set to a numeric > 0 then return that many random results.
-
-	-- If set to 0 then return 1 random result (as before).
 
 	-- If set to a numeric > the available results then return all
 	   results in a random order (previously returned the original








More information about the interchange-cvs mailing list