掲示板に書込があったら自動で参加者の携帯にワンギリコールをする・・・というシステムの開発案件があったので、モデムコントロール用の Perl モジュールを FreeBSD 4.X-R 系に入れてみた。
ああ、もう、perl も 5.8 の時代で、FreeBSD 4.X-RELEASE についてくる 5.005_003
では古くて、モジュールの最新は入らんよ。
で、苦労した。
■ まずは、SerialPort.pm をインストールする。
serv1# tar xvfz Device-SerialPort-0.09.tar.gz
Device-SerialPort-0.09/
Device-SerialPort-0.09/Device-SerialPort.html
Device-SerialPort-0.09/eg/
<略>
Device-SerialPort-0.09/t/test4.t
Device-SerialPort-0.09/MANIFEST
Device-SerialPort-0.09/Changes
serv1# cd Device-SerialPort-0.09
serv1# ls -la
total 156
drwxr-xr-x 4 501 100 512 Jan 28 2001 .
drwxr-xr-x 8 root wheel 1024 Jun 16 20:17 ..
-rw-r--r-- 1 501 100 2756 Jan 26 2001 Changes
-rw-r--r-- 1 501 100 43355 Jan 28 2001 Device-SerialPort.html
-rw-r--r-- 1 501 100 387 Sep 8 1999 MANIFEST
-rw-r--r-- 1 501 100 624 Aug 7 1999 Makefile.PL
-rw-r--r-- 1 501 100 9946 Jan 28 2001 README
-rw-r--r-- 1 501 100 86404 Jan 28 2001 SerialPort.pm
drwxr-xr-x 2 501 100 512 Sep 8 1999 eg
drwxr-xr-x 2 501 100 512 Jan 26 2001 t
serv1# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Device::SerialPort
serv1# make
mkdir blib
mkdir blib/lib
mkdir blib/lib/Device
cp SerialPort.pm blib/lib/Device/SerialPort.pm
<略>
mkdir blib/man3
Manifying blib/man3/Device::SerialPort.3
serv1# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t t/test1.............Use of uninitialized value at (eval 116) line 1.
Use of uninitialized value at (eval 118) line 1.
Use of uninitialized value at (eval 120) line 1.
Use of uninitialized value at (eval 122) line 1.
dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED tests 7-173
<略>
Failed 340/341 tests, 0.29% okay
Failed Test Status Wstat Total Fail Failed List of failed
-------------------------------------------------------------------------------
t/test1.t 1 256 173 167 96.53% 7-173
t/test2.t 1 256 46 45 97.83% 2-46
t/test3.t 1 256 159 153 96.23% 7-159
t/test4.t 1 256 341 340 99.71% 2-341
Failed 4/4 test scripts, 0.00% okay. 705/719 subtests failed, 1.95% okay.
*** Error code 2
Stop in /usr/local/src/Device-SerialPort-0.09.
ありゃりゃりゃ。何かやたらとエラーになったけど、make はちゃんと通ってたから、まあ、いいか。
make install してみよう。
serv1# make install
Installing /usr/local/lib/perl5/site_perl/5.005/Device/SerialPort.pm
Installing /usr/local/lib/perl5/5.00503/man/man3/Device::SerialPort.3
Writing /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Device/SerialPort/.packlist
Appending installation info to /usr/libdata/perl/5.00503/mach/perllocal.pod
ま、うまくいったんじゃないの?
<参考:これらは失敗>
perl Makefile.PL すらエラーで駄目だった
Device-SerialPort-0.12.tar.gz
Device-SerialPort-0.20.tar.gz ← これ以上は、perl 5.006 以上でないと駄目
Device-SerialPort-0.21.tar.gz
■ Modem.pm をインストールする
serv1# tar xvfz Device-Modem-1.28.tar.gz
Device-Modem-1.28/
Device-Modem-1.28/MANIFEST
Device-Modem-1.28/lib/
<略>
Device-Modem-1.28/Modem.pm
Device-Modem-1.28/README
Device-Modem-1.28/Makefile.PL
serv1# cd Device-Modem-1.28
serv1# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Device::Modem
serv1# make
mkdir blib
mkdir blib/lib
mkdir blib/lib/Device
cp lib/Device/Modem/Log/File.pm blib/lib/Device/Modem/Log/File.pm
<略>
Manifying blib/man3/Device::Modem::Log::File.3
Manifying blib/man3/Device::Modem::Log::Syslog.3
Manifying blib/man3/Device::Modem.3
serv1# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 test.pl
1..15
ok 1
No serial port set up, so *NO* tests will be executed...
To enable full testing, you can set these environment vars:
DEV_MODEM_PORT=[your serial port] (Ex.: 'COM1', '/dev/ttyS1', ...)
DEV_MODEM_BAUD=[serial link speed] (default is 19200)
On most unix environments, this can be done running:
DEV_MODEM_PORT=/dev/modem DEV_MODEM_BAUD=19200 make test
On Win32 systems, you can do:
set DEV_MODEM_PORT=COM1
set DEV_MODEM_BAUD=19200
nmake test (or make test)
skip 2
skip 3
skip 4
skip 5
skip 6
ありゃりゃ。
/dev/ttyS* デバイスを作ってなかったせいか、ほとんどテストをスキップされてしもうたぁ。
つーか、FreeBSD なら cuaa* だよな。
つーことで、環境変数にセットしてやる。
serv1# setenv DEV_MODEM_PORT /dev/cuaa0
serv1# setenv DEV_MODEM_BAUD 19200
serv1# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 test.pl
1..15
ok 1
Your serial port is `/dev/cuaa0' (environment configured)
Link baud rate is `19200' (environment configured)
ok 2
sending attention, modem says `'
ok 3
sending AT, modem says `OK'
ok 4
sending erroneous AT command, modem says `ERROR'
ok 5
sending ATZ reset command, modem says `OK'
ok 6
testing echo enable/disable...
ok 7
testing offhook function...
ok 8
hanging up...
ok 9
testing is_active() function...
ok 10
testing S registers read/write...
not ok 11
testing status of modem signals...
RING signal is off
DSR signal is off
CTS signal is off
RLSD signal is off
not ok 12
まあ、いいんじゃないの。
こんどは /dev/cuaa1 にして、もう一回テストをしてみる。
serv1# setenv DEV_MODEM_PORT /dev/cuaa1
serv1# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 test.pl
1..15
ok 1
Your serial port is `/dev/cuaa1' (environment configured)
Link baud rate is `19200' (environment configured)
ok 2
<略>
DSR signal is off
CTS signal is off
RLSD signal is off
not ok 12
同じ結果。よかろうてえ。
serv1# make install
Installing /usr/local/lib/perl5/site_perl/5.005/Device/Modem/Log/File.pm
Installing /usr/local/lib/perl5/site_perl/5.005/Device/Modem/Log/Syslog.pm
Installing /usr/local/lib/perl5/site_perl/5.005/Device/Modem.pm
Installing /usr/local/lib/perl5/5.00503/man/man3/Device::Modem::Log::File.3
Installing /usr/local/lib/perl5/5.00503/man/man3/Device::Modem::Log::Syslog.3
Installing /usr/local/lib/perl5/5.00503/man/man3/Device::Modem.3
Writing /usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Device/Modem/.packlist
Appending installation info to /usr/libdata/perl/5.00503/mach/perllocal.pod
終了。
<参考 URL>
http://search.cpan.org/author/COSIMO/Device-Modem-1.28/
http://search.cpan.org/author/COOK/Device-SerialPort-0.09/
|
|