perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Moyer <f...@redhotpenguin.com>
Subject Re: locality of $_ in ModPerl::MM and the like
Date Sun, 23 Aug 2009 20:28:39 GMT
On Sun, Aug 23, 2009 at 9:03 AM, Torsten
Foertsch<torsten.foertsch@gmx.net> wrote:
> Hi,
>
> recently I stumbled upon a curious thing. A freshly unpacked modperl
> aborted compilation after compiling in src/modules/perl. These are the
> symptoms:

....


+1 to this patch.  Has the added benefit of using a lexical loop
variable which is a better practice than 'for ... $_' in my humble
opinion.

> This patch introduces $o as loop variable instead of $_. For me the
> @default_opts loop was the culprit but I have changed all loops in
> WriteMakefile().
>
> Index: lib/ModPerl/MM.pm
> ===================================================================
> --- lib/ModPerl/MM.pm   (revision 806134)
> +++ lib/ModPerl/MM.pm   (working copy)
> @@ -132,22 +132,22 @@
>     my_import(__PACKAGE__);
>
>     # set top-level WriteMakefile's values if weren't set already
> -    for (@default_opts) {
> -        $args{$_} = get_def_opt($_) unless exists $args{$_}; # already defined
> +    for my $o (@default_opts) {
> +        $args{$o} = get_def_opt($o) unless exists $args{$o}; # already defined
>     }
>
>     # set dynamic_lib-level WriteMakefile's values if weren't set already
>     $args{dynamic_lib} ||= {};
>     my $dlib = $args{dynamic_lib};
> -    for (@default_dlib_opts) {
> -        $dlib->{$_} = get_def_opt($_) unless exists $dlib->{$_};
> +    for my $o (@default_dlib_opts) {
> +        $dlib->{$o} = get_def_opt($o) unless exists $dlib->{$o};
>     }
>
>     # set macro-level WriteMakefile's values if weren't set already
>     $args{macro} ||= {};
>     my $macro = $args{macro};
> -    for (@default_macro_opts) {
> -        $macro->{$_} = get_def_opt($_) unless exists $macro->{$_};
> +    for my $o (@default_macro_opts) {
> +        $macro->{$o} = get_def_opt($o) unless exists $macro->{$o};
>     }
>
>     ExtUtils::MakeMaker::WriteMakefile(%args);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message