in reply to preferred loading of XS modules

Module Text::CSV will take care of it automatically, but in general you could use the following:
my @modules=qw/Module::One_XS Module::Two_PP/; foreach my $module (@modules) { eval qq| use $module |; last unless $@ }

Update: As choroba astutely remarked the "next if $@" should be "last unless $@"

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: preferred loading of XS modules
by choroba (Cardinal) on Nov 25, 2015 at 21:01 UTC
    Didn't you mean
    last unless $@;

    ? Your code tries to use both the modules regardless of their availability.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
      Indeed, you are right.

      Funny enough, my initial code had the "last unless $@" and then I changed it. Silly me.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics
      my