May 26, 2018

Specify a return type for a function (optionally with coercion)

ReturnType allows you to specify a return type for your subs. Type constraints from any TypeTiny, MooseXTypes or MouseXTypes type library are supported.

The simple syntax for specifying a type constraint is shown in the “SYNOPSIS” [1]. If the attribute is passed a single type constraint as shown, this will be applied to the return value if called in scalar context, and to each item in the returned list if called in list context. If the sub is called in void context, type constraints are simply ignored.

[1] http//

WWW http//