會員登入 新朋友?立刻註冊
[說明]
文章會慢慢移新精讚 //n.sfs.tw
2019/2/23 星期六     [文章分類及列表]
精讚Blog logo 部落格是自己寫爽的
精讚部落 > 後端程設 > Perl 寫法
Freebsd 安裝PERL模組 Net::Oping 次要群組 [系統應用::FREEBSD] 列印 推薦
作者或來源 瘦河馬 2012-06-22 02:22:44
關鍵字 1oping 2freebsd 3perl
此文完整連結 http://n.zipko.info/773.html
文章歡迎轉載,請尊重版權註明連結來源。

Freebsd 安裝PERL模組 Net::Oping

家裡接了TBC的CABLE,雖然很快,但是常常會「瞬斷」,想寫程式來查這個現象,想到了使用PERL的 Net::Oping 來監測網路

一、用cpan安裝失敗

#  perl -MCPAN -e shell

cpan[4]> install Net::Oping

[...略...]
Scanning cache /root/.cpan/build for sizes
DONE
x Net-Oping-1.21/
x Net-Oping-1.21/t/
x Net-Oping-1.21/t/Oping.t
x Net-Oping-1.21/MANIFEST
x Net-Oping-1.21/lib/
x Net-Oping-1.21/lib/Net/
x Net-Oping-1.21/lib/Net/Oping.pm
x Net-Oping-1.21/typemap
x Net-Oping-1.21/Oping.xs
x Net-Oping-1.21/META.yml
x Net-Oping-1.21/Changes
x Net-Oping-1.21/README
x Net-Oping-1.21/Makefile.PL
CPAN: File::Temp loaded ok (v0.20)

  CPAN.pm: Going to build O/OC/OCTO/Net-Oping-1.21.tar.gz

******************************************************************************
* ERROR: COULD NOT FIND THE NEEDED HEADER FILE <oping.h>!                    *
******************************************************************************
The <oping.h> header file could not be found in the usual places. The prefix
paths searched right now are:
  /opt/oping, /usr, /usr/local

Please rerun Makefile.PL giving the prefix to the oping library using the
`OPING_PREFIX' argument. If you, for example, had installed the oping library
to /tmp/oping, the header file would be at /tmp/oping/include/oping.h; you'd
then need to run the Makefile.PL as follows:
  perl Makefile.PL OPING_PREFIX=/tmp/oping

As you can see, the argument passed via `OPING_PREFIX' must be the same
directory you passed to the liboping configure script using the `--prefix'
argument.


No Makefile has been created.
No 'Makefile' createdWarning (usually harmless): 'YAML' not installed, will not store persistent state
  OCTO/Net-Oping-1.21.tar.gz
  /usr/bin/perl Makefile.PL -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Could not read '/root/.cpan/build/Net-Oping-1.21-NZ319G/META.yml'. Falling back to other methods to determine prerequisites
Failed during this command:
 OCTO/Net-Oping-1.21.tar.gz                   : writemakefile NO -- No 'Makefile' created

不知道為什麼失敗,只知道找不到 oping.h

cpan> i /Net::oping/
Module id = Net::Oping
    CPAN_USERID  OCTO (Florian Forster <octopus@nospam.verplant.org>)
    CPAN_VERSION 1.21
    CPAN_FILE    O/OC/OCTO/Net-Oping-1.21.tar.gz
    INST_FILE    (not installed)

二、找找看有沒有預設的Ports,有時freebsd 會把perl 的模組弄成 port

失敗,沒有叫做 oping 的ports

三、下載tarball

這裡 http://search.cpan.org/~octo/Net-Oping/ 找到tar檔,可惜和我用CPAN裡拿到的一樣,裡面沒有oping.h

四、原來要裝這個東西

找了很久,還好自己靈光乍現,是不是要先裝這個 liboping

# cd /usr/ports/net/liboping
# make install

五、再用cpan安裝即可,同步驟一

Found <oping.h> in /usr/local/include
Checking if your kit is complete...
Looks good
Writing Makefile for Net::Oping
[--略--]
Manifying blib/man3/Net::Oping.3
  OCTO/Net-Oping-1.21.tar.gz
  /usr/bin/make -- OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Oping....ok
All tests successful.
Files=1, Tests=5,  1 wallclock secs ( 0.05 cusr +  0.01 csys =  0.05 CPU)
  OCTO/Net-Oping-1.21.tar.gz
  /usr/bin/make test -- OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make install
Prepending /root/.cpan/build/Net-Oping-1.21-SN4nww/blib/arch /root/.cpan/build/Net-Oping-1.21-SN4nww/blib/lib to PERL5LIB for 'install'
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib/perl5/site_perl/5.8.9/mach/auto/Net/Oping/Oping.so
Installing /usr/local/lib/perl5/site_perl/5.8.9/mach/auto/Net/Oping/Oping.bs
Installing /usr/local/lib/perl5/site_perl/5.8.9/mach/Net/Oping.pm
Installing /usr/local/lib/perl5/5.8.9/man/man3/Net::Oping.3
Writing /usr/local/lib/perl5/site_perl/5.8.9/mach/auto/Net/Oping/.packlist
FreeBSD: Registering installation in the package database
Appending installation info to /usr/local/lib/perl5/5.8.9/mach/perllocal.pod

  OCTO/Net-Oping-1.21.tar.gz
  /usr/bin/make install  -- OK


 

 

END
F B 留 言 版

留言結束請重新整理網頁顯示留言
相 關 文 章
同 群 組 其 他 文 章
隨 機 文 章
精讚部落版權所有(c) JinZan Blog http://n.zipko.info Author axer@tc.edu.tw. 最佳瀏器為Firefox,本網頁不支援IE6。[文章分類及列表]
本站最佳瀏覽解析度1024x768 網站建置 2009.11