Philippe M. Chiasson wrote:
Isn't "return;" the more canonical way of returning false ?
Beats me... I know a lot of the mp2 code particular Apache2::Status as I
was just digging in there uses return 0. I really have no preference.
Minor nit, but wouldn't
my @tuples = split /\./, $has_version;
my @r_tuples = split /\./, $requested_version;
return cmp_tuples([EMAIL PROTECTED], [EMAIL PROTECTED]) == 1;
sub cmp_tuples {
my ($a, $b) = @_;
while(@$a && @$b) {
my $cmp = shift @$a <=> shift @$b;
return $cmp if $cmp;
}
return @$a <=> @$b;
}
Be a more generic approach that would also work if there is ever a
gcc-4.0.0.1 and could possibly be used to refactor some more version
comparaisons ?
More generic yes. But working no. :)
<=> returns 1, 0, -1, and undef for NaN.
both 1 and -1 are true in perl.
That should be
> return $cmp if $cmp;
return 1 if $cmp == 1;
Whith that minor change, I agree.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]