use strict;
use warnings;
eval {
require Inline; Inline->import (C => Config =>
BUILD_NOISY => 1);
require Inline; Inline->import (C =><<' EOC');
int foo() {
warn("Using Inline\n");
return 42;
}
EOC
};
# If Inline is unavailable, foo() simply calls
# the sub bar() pure perl implementation.
if($@) {
*foo =\&bar;
}
sub bar {
warn("Using Pure Perl Implementation\n");
return 42;
}
my $x = foo();
print "$x\n";
####
Using Pure Perl Implementation
42
##
##
Using Inline
42