所以我最初使用的是File
類型,但是由於類型驗證失敗,所以我將它切換到Dir
。但最終的路徑是一個文件,所以我不確定我做錯了什麼。爲什麼這會返回一個Path :: Class :: Dir而不是文件?
use strict;
use warnings;
use namespace::autoclean;
# VERSION
use Moose::Role;
use MooseX::Types::Moose qw(Str);
use MooseX::Types::Path::Class qw(File Dir);
use File::ShareDir::PathClass;
has cybs_wsdl => (
required => 0,
lazy => 1,
is => 'ro',
isa => Dir,
builder => '_build_cybs_wsdl',
);
sub _build_cybs_wsdl {
my $self = shift;
my $wsdl = 'CyberSourceTransaction_1.62.wsdl';
my $file
= File::ShareDir::PathClass->dist_file(
'Business-CyberSource',
$wsdl
);
return $file;
}
注:最終路徑是這樣的:/home/ccushing/Business-CyberSource/.build/rzuQn5s899/blib/lib/auto/share/dist/Business-CyberSource/CyberSourceTransaction_1.62.wsdl
@xenoterracide,固定在1.112440 – ikegami