my $has_PDL = eval "use Wrap::PDL qw(my_method); 1"; #... if ($has_PDL) { my_method(0, 0, $value); }