The multi dispatcher *only* chooses the multi candidate by matching arguments to parameters. The return type is not considered.
Btw, the syntax for returning an arrayish thing might be: method foo($a, $b --> Positional) { ... } Am 19.03.2015 um 23:53 schrieb Darren Duncan: > I think as a general principle, multi methods should dispatch entirely > on their parameter signatures, and dispatching on return type is just > a bad design that leads to trouble. If you want different return > types for identical parameters, you should give those 2 versions > different method base names. -- Darren Duncan > > On 2015-03-19 3:20 PM, Tom Browder wrote: >> I need to replace the Perl 5 'wantarray' and think a multi method with >> differing return types should do it. >> >> So I've tried this: >> >> multi method foo($a, $b --> {Num,Num}) { #... } >> multi method foo($a, $b --> Num) { #... } >> >> and get errors like: >> >> Missing block >> at Ellipsoid.pm:672 >> ------> ethod to($lat1, $lon1, $lat2, $lon2 --> �{Rat, Rat}) >> from test_ellipsoid.pl:12 >> >> I've tried parentheses, square brackets, and no grouping characters >> instead of curly braces but that doesn't change the error. >> >> Question: >> >> How does one properly provide differing function return type signatures? >> >> Thanks. >> >> Best, >> >> -Tom >> >