On Friday, January 30, 2004, at 11:56 PM, Holt Sorenson wrote:


I'm using the following:

use Inline (ASM => 'DATA',
            AS => 'as',
            PROTO => { getsp => 'unsigned long()' });

... perl code ...

[...]

I would like my program to run even if Inline ASM isn't available.


Try this:

BEGIN { eval q{
  use Inline (ASM => 'DATA',
              AS => 'as',
              PROTO => { getsp => 'unsigned long()' });
  };
}


That basic formula, turning "use Foo" into "BEGIN { eval 'use Foo' }" should work for any module.


To check whether Inline was loaded, you should be able to examine the $@ variable:

BEGIN { eval q{
  use Inline (ASM => 'DATA',
              AS => 'as',
              PROTO => { getsp => 'unsigned long()' });
  };
  $HAVE_INLINE = not $@;
}



Reply via email to