How do I declare a class attribute as a union of class names?
问题 I'm reading a spreadsheet looking for different structures. When I tried the following using Moose it seems to do what I want. I could create different types of objects, assign this to the found member and dump the Cell instance for review. package Cell { use Moose; use Moose::Util::TypeConstraints; use namespace::autoclean; has 'str_val' => ( is => 'ro', isa => 'Str', required => 1 ); has 'x_id' => ( is => 'ro', isa => 'Str', ); # later required => 1 ); has 'color' => ( is => 'ro', isa =>