- Community Home
- >
- HPE Community, Japan
- >
- HP-UX
- >
- System Management
- >
- perl実行時のエラー
カテゴリ
Company
Local Language
フォーラム
ディスカッションボード
フォーラム
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
ディスカッションボード
ディスカッションボード
ディスカッションボード
フォーラム
ディスカッションボード
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
フォーラム
ブログ
- RSS フィードを購読する
- トピックを新着としてマーク
- トピックを既読としてマーク
- このトピックを現在のユーザーにフロートします
- ブックマーク
- 購読
- 印刷用ページ
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-17-2005 10:30 PM
03-17-2005 10:30 PM
perl実行時のエラー
仕事であるツールの定期監視を少しでも楽にする為にSEさん作成のプログラム(Perl V5.8.xで)をhp-ux11i上のperl "perl B.5.6.1.F"のバージョンで、動作させようとしていますが、以下の様なエラーが出力されてしまいます。
どこが原因なのかがさっぱり分かりません。(Perlは初めて使います)
初心者ですがどなたか原因&対応方法を教えて頂けますでしょうか?
----ここからソース
#!/usr/contrib/bin/perl
use File::Basename;
use Getopt::Long;
$getpg = basename($0,"");
:
----ここ迄がソース
実行環境(rootにて)
# find / -name perl -print
/opt/perl
/opt/perl/html/perl
/opt/perl/bin/perl
/usr/contrib/bin/perl
/usr/contrib/Q4/bin/perl
/var/adm/sw/products/perl
/var/adm/sw/save/PHCO_25723/Q4/usr/contrib/Q4/bin/perl
/var/adm/sw/save/PHCO_29995/Q4/usr/contrib/Q4/bin/perl
# ls -l /opt/perl/bin/perl
-r-xr-xr-x 1 bin bin 1555108 Jun 24 2002 /opt/perl/bin/perl
# ls -l /usr/contrib/bin/perl
-r-xr-xr-x 1 bin bin 963092 Nov 14 2000 /usr/contrib/bin/perl
# which perl
/usr/contrib/bin/perl
# swlist -l product | grep Perl
Perl5 B.5.6.1.F Perl for HP-UX
実行時のエラー
Can't locate File/Basename.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/l
ib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5/lib/site_perl/5.005 .) at ./chk.pl line 3.
BEGIN failed--compilation aborted at ./chk.pl line 3.
宜しくお願いします。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-18-2005 07:11 AM
03-18-2005 07:11 AM
perl実行時のエラー
Can't locate File/Basename.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/l
ib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5/lib/site_perl/5.005 .) at ./chk.pl line 3.
BEGIN failed--compilation aborted at ./chk.pl line 3.
このメッセージからすると、@INC変数に設定されているサーチパスを順にたどっても、Perl のモジュールが入ったファイル、"Basename.pm" が見つからなかった、ということのようです。"Basename.pm" という名前からすると、U*IXのファイルパス名文字列から、一番後ろのファイル名だけを文字列として取り出す関数が入っているのでは、と思います。(例えば "/bin/sh" のbasename は "sh" )
それはさておき、"Basename.pm" というファイルをとにかく見つけて、パス名を@INC に追加するか、または、"Basename.pm" を@INCに既に入っているパス、例えば、/opt/perl5/lib/5.00502 の下にコピーしてやれば、"Can't locate File/Basename.pm" は解消できるのでは。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-18-2005 11:37 AM
03-18-2005 11:37 AM
perl実行時のエラー
このperlはバージョンが古いです。
5.6.1のperlは/opt/perl/binにあります。
古いperlを指定しているために、
> Can't locate File/Basename.pm in @INC (@INC
> contains: /opt/perl5/lib/5.00502/PA-RISC1.1
> /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1
> /opt/perl5/lib/site_perl/5.005 .) at ./chk.pl line 3.
という具合に、古いライブラリパスを見に行っています。
5.6.1には、File::Basenameは含まれているので、スクリプトの最初の行を
#!/opt/perl/bin/perl
とすればこのエラーはなくなります。
蛇足ですが、
# swlist -l file Perl5
とすれば、このパッケージのPerlがどのパスにインストールされているか確認できますよ。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-18-2005 11:07 PM
03-18-2005 11:07 PM
perl実行時のエラー
有難うございます。
調べた結果、古いライブラリを検索している状態でした。
無事に新しいパスを検索する様に設定変更してエラー表示されなくなりました。
動作結果は、まだバグがあるみたいですがとりあえず前進しましたので、一安心です。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-19-2005 11:28 AM
03-19-2005 11:28 AM
perl実行時のエラー
ということは、スクリプトで指定しているperlの実行ファイルは/usr/contrib/bin/perlのままですか?
これ、5.6.1じゃないので、@INCの指定だけ5.6.1用にすると問題が起きるかもしれません。
スクリプト1行目のインタプリタの指定を変更することをお勧めします。
(以下にバージョンの出力を載せます。)
なお、"/opt/perl/bin/perl"を使うようにすれば、デフォルトで5.6.1のライブラリを見に行くはずです。
-----
$ /usr/contrib/bin/perl -version
This is perl, version 5.005_02 built for PA-RISC1.1
...
$ /opt/perl/bin/perl -version
This is perl, v5.6.1 built for PA-RISC1.1-thread-multi
(with 1 registered patch, see perl -V for more detail)
...
-------
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
03-19-2005 11:41 AM
03-19-2005 11:41 AM
perl実行時のエラー
解決策: スクリプトを以下のように変更してください。
(設定変更の必要は無いはずです。)
--- Before (Line : 1) ---
#!/usr/contrib/bin/perl
-------------------------
--- After (Line : 1) ---
#!/opt/perl/bin/perl
------------------------
理由 :
> # find / -name perl -print
<中略>
> /opt/perl/bin/perl
これ(↑)は5.6.1ですが、
> /usr/contrib/bin/perl
これ(↑)は、5.005と古いバージョンなのです。
5.6.1には、File::Basenameモジュールは含まれていますから、「解決策」に記載したとおり、5.6.1のperlを使用するようにスクリプトを修正することで、5.6.1のライブラリパスを参照し、ロードしてくれるはずです。