p5-type-tiny icon indicating copy to clipboard operation
p5-type-tiny copied to clipboard

how to avoid loading class you want to coerce to?

Open XSven opened this issue 1 year ago • 0 comments

Although not explicitly stated in Type::Tiny::Manual::Coercions Type::Tiny based coercion requires that the class you want to coerce to is previously loaded, otherwise you get a exception like

Can't locate object method "parse" via package "Foo" (perhaps you forgot to load "Foo"?) at compiled coercion 'to_Name' line 1.

Params::Coerce has a different philosophy Loading-Classes.

How to tell Type::Tiny to load the class you want to coerce to at run-time?

XSven avatar Nov 27 '23 12:11 XSven