Re: Change 17347: Support hints and OPTIMIZE in MM_MacOS

[email protected] (Michael G Schwern) Tue, 16 Jul 2002 16:46:06 -0400
Newsgroups perl.perl5.porters,perl.perl5.changes.mac
Message-ID <[email protected]>
I'd rather not put yet more duplicated code into MakeMaker.  Is there
something that can be done to MakeMaker.pm's version of the methods to make
them generic?  Something from File::Spec?


On Sat, Jun 22, 2002 at 05:37:54PM -0400, Chris Nandor wrote:
> +# yes, these are just copies of the same routines in
> +# MakeMaker.pm, but with paths changed.
> +sub check_hints {
> +    my($self) = @_;
> +    # We allow extension-specific hints files.
> +
> +    return unless -d ":hints";
> +
> +    # First we look for the best hintsfile we have
> +    my($hint)="${^O}_$Config{osvers}";
> +    $hint =~ s/\./_/g;
> +    $hint =~ s/_$//;
> +    return unless $hint;
> +
> +    # Also try without trailing minor version numbers.
> +    while (1) {
> +        last if -f ":hints:$hint.pl";      # found
> +    } continue {
> +        last unless $hint =~ s/_[^_]*$//; # nothing to cut off
> +    }
> +    my $hint_file = ":hints:$hint.pl";
> +
> +    return unless -f $hint_file;    # really there
> +
> +    _run_hintfile($self, $hint_file);
> +}
> +
> +sub _run_hintfile {
> +    no strict 'vars';
> +    local($self) = shift;       # make $self available to the hint file.
> +    my($hint_file) = shift;
> +
> +    local $@;
> +    print STDERR "Processing hints file $hint_file\n";
> +    my $ret = do $hint_file;
> +    unless( defined $ret ) {
> +        print STDERR $@ if $@;
> +    }
> +}
>  1;


-- 
This sig file temporarily out of order.