ライブラリパスの指定方法

| 0 Comments | 0 TrackBacks | このエントリーをはてなブックマークに追加 このエントリーのはてなブックマーク件数

こんばんは!


ライブラリ使ってる? オレオレライブラリのパスってどうやって指定してます?


これだと、違うパスに移動すると死亡だよね。

use lib '/oreore/lib';

これだと、パスをかえても動くけど、起動時にいる場所がかわるとだめだよね。

use lib './../lib';

これだと、構成が同じなら、どこにいても動くね!

use FindBin;
use lib $FindBin::Bin . './../lib' ;

さらに、Windowsのパスでもこれだと動くね!

use FindBin;
use File::Spec;
use lib File::Spec->catfile( $FindBin::Bin , '../lib' );

さらに、これだと一行ですむね!

use FindBin::libs;

みんなはどうやってる?!

じゃね!

No TrackBacks

TrackBack URL: http://perl-mongers.org/MT/mt-tb.cgi/4

Leave a comment

About this Entry

This page contains a single entry by tomyhero [livedoor.com] published on May 21, 2008 4:09 PM.

perlで文字連結 was the previous entry in this blog.

もらったデータの構造がわかんないときは Data::Dumper におまかせ! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

Creative Commons License
This blog is licensed under a Creative Commons License.
Powered by Movable Type 4.21-en