subtype 'ExistingFile' => as 'AFile' => where { say "In subtype where clause: $_[0]"; -f $_[0] }, message { "$_[0] does not exist" }; coerce 'ExistingFile' => from 'Str' => via { file($_) }; has file => ( isa => 'ExistingFile', is => 'ro', required => 1, coerce => 1 );