Skip Menu |

This queue is for tickets about the Devel-CheckLib CPAN distribution.

Report information
The Basics
Id: 66717
Status: new
Priority: 0/
Queue: Devel-CheckLib

People
Owner: Nobody in particular
Requestors: chm [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.92
Fixed in: (no value)



Subject: alternate main body doesn't work without lib argument
If you check for the availability of  a function of feature without
giving a library argument, function argument is never actually
used in a trial compile and a failure is not reported:

$ less checklib-test.pl
use Devel::CheckLib;

my $function = 'bogus();';
my $header = 'math.h';
my $library = ['m'];

$status = check_lib(function=>$function);
print "check_lib(function=>$function) got " . ($status?1:0) . "\n";

$status = check_lib(header=>$header,function=>$function);
print "check_lib(header=>'$header',function=>'$function') got " . ($status?1:0) . "\n";

$status = check_lib(lib=>$library,function=>$function);
print "check_lib(lib=>['@$library'],function=>'$function') got " . ($status?1:0) . "\n";

$status = check_lib(lib=>$library,header=>$header,function=>$function);
print "check_lib(lib=>['@$library'],header=>'$header',function=>'$function') got " . ($status?1:0) . "\n";

$ ./checklib-test.pl
check_lib(function=>bogus();) got 1
check_lib(header=>'math.h',function=>'bogus();') got 1
check_lib(lib=>['m'],function=>'bogus();') got 0
check_lib(lib=>['m'],header=>'math.h',function=>'bogus();') got 0

I would say this is more of a feature request except for the
silent failure.  One possible fix would be to disallow this mode
(which would make it inconvenient to test for existing functionality
in the default library and header search paths).

A better would be to add a null library check if a function is
specified and no libraries were passed to check.  A workaround
the problem is to add a library that you know will be there
(tricky but maybe -lm will work).




Subject: checklib-test.pl
#!/usr/bin/perl use Devel::CheckLib; my $function = 'bogus();'; my $header = 'math.h'; my $library = ['m']; $status = check_lib(function=>$function); print "check_lib(function=>$function) got " . ($status?1:0) . "\n"; $status = check_lib(header=>$header,function=>$function); print "check_lib(header=>'$header',function=>'$function') got " . ($status?1:0) . "\n"; $status = check_lib(lib=>$library,function=>$function); print "check_lib(lib=>['@$library'],function=>'$function') got " . ($status?1:0) . "\n"; $status = check_lib(lib=>$library,header=>$header,function=>$function); print "check_lib(lib=>['@$library'],header=>'$header',function=>'$function') got " . ($status?1:0) . "\n";