You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2005/08/24 22:04:49 UTC
Re: svn commit: r239724 - /perl/modperl/trunk/lib/Apache2/Build.pm
> +sub cmp_tuples {
> +
> + my($a, $b) = @_;
> +
> + while (@$a && @$b) {
> + my $cmp = shift @$a <=> shift @$b;
> + return $cmp if $cmp;
> + }
> +
> + return @$a <=> @$b;
> +}
Philip, please avoid using $a and $b in any code, but sort() callbacks, as
they are special in perl and may have bad side effects.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://mailchannels.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: svn commit: r239724 - /perl/modperl/trunk/lib/Apache2/Build.pm
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Philip M. Gollucci wrote:
> Stas Bekman wrote:
>
>>> +sub cmp_tuples {
>>> +
>>> + my($a, $b) = @_;
>>> +
>>> + while (@$a && @$b) {
>>> + my $cmp = shift @$a <=> shift @$b;
>>> + return $cmp if $cmp;
>>> + }
>>> +
>>> + return @$a <=> @$b;
>>> +}
>>
>> Philip, please avoid using $a and $b in any code, but sort()
>> callbacks, as they are special in perl and may have bad side effects.
>
> Gozer wrote that :)
Yup, it was only an example ;-) But, really, stas is correct, $a and $b can
have some nasty side effects.
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Re: svn commit: r239724 - /perl/modperl/trunk/lib/Apache2/Build.pm
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Stas Bekman wrote:
>
>> +sub cmp_tuples {
>> +
>> + my($a, $b) = @_;
>> +
>> + while (@$a && @$b) {
>> + my $cmp = shift @$a <=> shift @$b;
>> + return $cmp if $cmp;
>> + }
>> +
>> + return @$a <=> @$b;
>> +}
>
>
> Philip, please avoid using $a and $b in any code, but sort() callbacks,
> as they are special in perl and may have bad side effects.
Gozer wrote that :)
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci (pgollucci@p6m7g8.com) 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: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org