Help for this page

Select Code to Download


  1. or download this
    has file => ( isa => 'ExistingFile', is => 'ro', required => 1, coerce
    + => 1 );
    
  2. or download this
    You cannot coerce an attribute (file) unless its type (ExistingFile) h
    +as a coercion at /tmp/test.pl line 26
    
  3. or download this
    subtype 'ExistingFile' =>
        as 'AFile' =>
    ...
        via { file($_) };
    
    has file => ( isa => 'ExistingFile', is => 'ro', required => 1, coerce
    + => 1 );
    
  4. or download this
    for my $ftype (qw/ AFile ExistingFile /) {
        coerce  $ftype =>
            from 'Str' =>
            via { file($_) };
    }