Net::Bluetoothを使う

脱線ついでにperlであそんでみる。perlbluetoothを使うなら、Net::Bluetoothらしい。


今回もためした環境はubuntu7.10。
あとlibbluetooth2-devも必要。

$ sudo aptitude install libbluetooth2-dev


Net::Bluetooth - Perl Bluetooth Interface - metacpan.org
このページのNet-Bluetooth-0.40.tar.gzをダウンロードする。


適当なディレクトリで展開する

$ tar xzvf Net-Bluetooth-0.40.tar.gz


make。

$ cd Net-Bluetooth-0.40/
$ perl Makefile.PL
$ make


make testする。

$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
0..1
ok 1
All tests successful!

successfulって言ってるからだいじょうぶなんだ。


インストール。

$ sudo make install


次にsampleを試す。

$ cd samples/
$ perl device_discovery
Address: **:**:**:**:**:** Name: PLEN ***

ちゃんとPLENを見つけた。