这里使用FindBin是该方案,我有两个文件: 1. DIR/A.pm 2. DIR/NEW_DIR /在在多个模块
这是A.pm的样子:
package A;
use FindBin;
use Test::More;
is (FindBin->again, 'dir', 'got dir');
1;
这是怎样的样子:
use FindBin;
use Test::More qw(no_plan);
use A;
is (FindBin->again, 'dir/new_dir', 'got dir/new_dir');
于是我就在文件中使用Perl NEW_DIR/AT和期待我的测试通过。但这是我的测试结果:
not ok 1 - got dir
# Failed test 'got fir'
# at A.pm line 6.
# got: 'dir/new_dir'
# expected: 'dir'
ok 2 - got dir/new_dir
1..2
我做错了什么?我对perl很陌生。请帮忙!!
“无可否认,文档中有些混淆地提到”已知问题“一节中的”模块“,但这并不意味着您认为它的意思。” - 我想我误解了FindBin->的含义。我现在很清楚。感谢所有的帮助! – junbon