Attributes are single items but they can origin from any number of values. Sure one can explicitly flatten or coerce to a single value like this:
Show quoted text> $thing->foo( some_flattening_sub('x', 'y', 'z') );
However, I found it more convenient to put this into coercing. Sure it's a matter of coding style. If it "seems wrong" to you, I'll to have hack another solution. See <a href="http://prepan.org/module/nXWJ8Y9sBiu">Class::Accessor::Coerce</a> at PrePAN and <a href="https://github.com/nichtich/Class-Accessor-Coerce/blob/master/lib/Class/Accessor/Coerce.pm#L28">the examples in its documentation</a>. The downside of this solution is that one must refer to the coercing sub at two places for the constructor and for the accessor.
Show quoted text> It also breaks consistency with setting attributes in constructors.
No it does't. One just cannot provide more than one argument in the constructor, so what?
Show quoted text> It would seem much more sensible for your code to work with an
> arrayref:
>
> $thing->foo( ['x', 'y'] );
Yes, and one could use has references as well:
Show quoted text> $thing->person( { given => $given, surname => $surname } );
Do I really have to argue that the following forms are more convenient?
Show quoted text> $thing->sum( 1, 3, 2 );
> $thing->person( given => $given, surname => $surname );