So I was using File for the type originally but for type validation was failing, so I switched it to Dir. However the final path is a file, so I’m not sure what it is that I’m doing wrong.
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;
}
note: final path is this: /home/ccushing/Business-CyberSource/.build/rzuQn5s899/blib/lib/auto/share/dist/Business-CyberSource/CyberSourceTransaction_1.62.wsdl
It’s a bug in File::ShareDir::PathClass.
Patch:
Filed a ticket