I have some background in Perl, but I'm no guru. I'm just hoping to gain some clarity. So I wanted to install LEGO::NXT on a Fedora box through CPAN, and here is the story:
Code:
root@RoboLinux:~/.cpan/build/LEGO-NXT-2.00-1-zW4ntG$ cpan
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.
cpan[1]> install LEGO::NXT
CPAN: Storable loaded ok (v2.18)
Going to read '/root/.cpan/Metadata'
Database was generated on Fri, 08 Jan 2010 19:42:03 GMT
CPAN: YAML loaded ok (v0.71)
Going to read 3 yaml files from /root/.cpan/build/
CPAN: Time::HiRes loaded ok (v1.9719)
DONE
Restored the state of none (in 0.1274 secs)
Running install for module 'LEGO::NXT'
Running make for C/CO/COLLINS/LEGO-NXT-2.00-1.tar.gz
Has already been unwrapped into directory /root/.cpan/build/LEGO-NXT-2.00-1-zW4ntG
Has already been made
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_pod.t .... ok
t/01_basic.t .. ok
All tests successful.
Files=2, Tests=14, 1 wallclock secs ( 0.03 usr 0.00 sys + 0.16 cusr 0.01 csys = 0.20 CPU)
Result: PASS
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
No Bluetooth Address Specified!
make: *** [test_dynamic] Error 255
COLLINS/LEGO-NXT-2.00-1.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports COLLINS/LEGO-NXT-2.00-1.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
COLLINS/LEGO-NXT-2.00-1.tar.gz : make_test NO
I know very little about how CPAN building works, so I looked in .cpan and found a file called test.pl for the module I am trying to build:
Code:
root@RoboLinux:~/.cpan/build/LEGO-NXT-2.00-1-zW4ntG$ cat test.pl
use LEGO::NXT;
use LEGO::NXT::BlueComm;
use LEGO::NXT::Constants qw(:DEFAULT);
use Data::Dumper;
use Net::Bluetooth;
use strict;
my $addr = $ARGV[0];
my $port = 1;
die "No Bluetooth Address Specified!\n" if !$addr;
$| = 1;
my $res;
my $bt = LEGO::NXT->new( new LEGO::NXT::BlueComm($addr,$port) );
$res = $bt->play_sound_file($NXT_RET, 0,'! Attention.rso');
print Dumper($res);
$res = $bt->get_battery_level($NXT_RET);
print Dumper($res);
exit;
#Also try these!
#
#$res = $bt->play_tone($NXT_RET,220*2,500);
#$bt->set_output_state($NXT_NORET, $NXT_MOTOR_A, 100, $NXT_MOTORON|$NXT_REGULATED, $NXT_REGULATION_MODE_MOTOR_SPEED, 0, $NXT_MOTOR_RUN_STATE_RUNNING, 0 );
Evidently this is the test that failed because I can see the "No Bluetooth Address Specified!" error message in it. But looking at the test, I don't understand how it would ever succeed (being tried within CPAN) because you have to pass in a BlueTooth address as an argument to the script. Shouldn't the CPAN installer ask me for one, then? Or am I supposed to run some other command before trying to install the module so it knows to pass the argument?