Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Non-fatal error handling with Mouse types?

by tobyink (Canon)
on Oct 03, 2019 at 08:08 UTC ( #11106997=note: print w/replies, xml ) Need Help??


in reply to Non-fatal error handling with Mouse types?

Use coercion.

use Types::Standard qw(Any Enum); has error_mode => ( is => 'rw', isa => (Enum[qw/carp error both/])->plus_coercions(Any, q{'both'} +), # default to 'both' coerce => 1, );

(Coercions can also be done with native Mouse types, but that requires more lines of code, and I can't remember how off the top of my head.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11106997]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2021-01-16 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?