On Thu, 24 Apr 2008 20:48:34 -0700
Geoffrey Broadwell <[EMAIL PROTECTED]> wrote:

> Also, the implementation of C<_add_to_libs> is a little wordy.  How's
> this?
> 
>  sub _add_to_libs {
>      my ($self, $args) = @_;
>      croak "_add_to_libs() takes hashref" unless ref($args) eq 'HASH';
> 
>      my $os       = $args->{osname};
>      my $cc       = $args->{cc};
>      my $platform = $os =~ /mswin32/i && $cc =~ /^gcc/i ? 'win32_gcc'   :
>                     $os =~ /mswin32/i                   ? 'win32_other' :
>                     $os =~ /darwin/i                    ? 'darwin'      :
>                                                         ? 'default'     ;
> 
>      my $libs     = $args->{$platform} || $args->{default};
> 
>      $args->{conf}->data->add(' ', libs => $libs);
>      return 1;
>  }

Pretty.  Easy to read, easy to maintain.  And +1 for using Carp,
too.

Mark

Reply via email to