10

カートンを展開コンテナーとして使用しようとしています。しかし、私は小さな問題に遭遇しました。プライベート モジュールのインストール方法がわかりません。

クイック テスト モジュールを作成しました。

h2xs -AX Foo::Bar

tree Foo-Bar/
Foo-Bar/
├── Changes
├── lib
│   └── Foo
│       └── Bar.pm
├── Makefile.PL
├── MANIFEST
├── README
└── t
    └── Foo-Bar.t

パッケージ化:パッケージをディレクトリtar cvfz Foo-Bar-0.01.tar.gz Foo-Bar/ にコピーしました。vendor/cache

ls vendor/cache/
Foo-Bar-0.01.tar.gz  Try-Tiny-0.18.tar.gz

cat cpanfile
requires 'Foo::Bar', '0.01';
requires 'Try::Tiny', '0.18';

carton install --cached
Installing modules using /home/donpedro/Garbage/Carton/cpanfile
! Couldn't find module or a distribution Foo::Bar (0.01)
Successfully installed Try-Tiny-0.18
! Installing the dependencies failed: Module 'Foo::Bar' is not installed
! Bailing out the installation for /home/donpedro/Garbage/Carton/.
1 distribution installed
Installing modules failed

Milla のデフォルト モジュール (チュートリアルの例、milla 新しい Dist-Name) も試しましたが、結果はありませんでした。ドキュメントには、DarkPan モジュールの場合、モジュールを vendor/cache ディレクトリにドロップするだけであることが記載されています。公式の CPAN モジュールは vendor/cache ディレクトリにドロップするだけです。

次に何を試すべきか、または問題を解決するにはどうすればよいですか? :)

編集: carton IRC チャンネルの miyagawa と lejeunerenard から次の情報が得られました: 現時点でこれを機能させるには、Carton 1.1 (現在の安定版 1.0) と新しい cpanfile dev バージョンが必要です。cpanfile に新しいオプションがあります -dist => '/path/to/Foo-Bar.tar.gz' argument for the requires method

私は怠惰すぎてアーリー アダプターにはなれないので、CPAN バンドルには Carton を、プライベート バンドルには cpanm を使用します。

ミヤガワとルジュネレナールに感謝します。

4

2 に答える 2

0

また、モジュールを local/lib/custom (または何でも) に配置してから、その lib を perl アプリで使用することもできます。または、それを PERL5LIB に追加するか、perl -Ilocal/lib/custom を使用します。

于 2015-06-19T20:52:19.030 に答える