# New Ticket Created by  James Keenan 
# Please include the string:  [perl #53270]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=53270 >


There are five configuration step classes where the class's runstep()  
method has an internal subroutine called _handle_mswin32().  These  
classes are:

config/auto//crypto.pm
config/auto//gettext.pm
config/auto//gmp.pm
config/auto//opengl.pm
config/auto//readline.pm

Attached is an example of this subroutine, in this case, from  
auto::readline:

sub _handle_mswin32 {
    my ($conf, $osname, $cc) = @_;
    if ( $osname =~ /mswin32/i ) {
        if ( $cc =~ /^gcc/i ) {
            $conf->data->add( ' ', libs => '-lreadline' );
        }
        else {
            $conf->data->add( ' ', libs => 'readline.lib' );
        }
    }
    else {
        $conf->data->add( ' ', libs => '-lreadline' );
    }
    return 1;
}

Since this subroutine is declared with the same structure in 5  
different classes, I propose that we refactor it into a method which,  
by analogy with similar subroutines, we would place in  
Parrot::Configure::Step::Methods.

More importantly, I propose that this subroutine be renamed.  As you  
can see from the sample, its action is *not* limited to mswin32.   
Rather, it behaves one way on mswin32 -- actually, two ways,  
depending on gcc or not -- and a different way on all other OSes.   
How about:  _add_flags_to_libs()?

I'll draw up an actual patch in a day or two, but first let me ask if  
this sounds like a good idea or not.

Thank you very much.
kid51

Reply via email to