Pair Networks


Imager::Probe - hot needle of inquiry for libraries


  require Imager::Probe;

  my %probe = 
     # short name of what we're looking for (displayed to user)
     name => "FOO",
     # pkg-config lookup
     pkg => [ qw/name1 name2 name3/ ],
     # perl subs that probe for the library
     code => [ \&foo_probe1, \&foo_probe2 ],
     # or just: code => \&foo_probe,
     inccheck => sub { ... },
     libcheck => sub { ... },
     # search for this library if libcheck not supplied
     libbase => "foo",
     # library link time options, uses libbase to build options otherwise
     libopts => "-lfoo",
     # C code to check the library is sane
     testcode => "...",
     # header files needed
     testcodeheaders => [ "stdio.h", "foo.h" ],
  my $result = Imager::Probe->probe(\%probe)
    or print "Foo library not found: ",Imager::Probe->error;


Does the probes that were hidden in Imager's Makefile.PL, pulled out so the file format libraries can be externalized.

The return value is either nothing if the probe fails, or a hash containing:

The possible values for the hash supplied to the probe() method are: