++ed by:
MELO ROMANF RRWO

3 PAUSE users
3 non-PAUSE users.

Toby Inkster
and 1 contributors

PURPOSE

Here's a simple use case for MooseX::MungeHas. View this files's source code for the full script.

We use an environment variable to toggle type constraint checks:

 use MooseX::MungeHas $ENV{PERL_FASTER} ? qw(is_ro no_isa) : qw(is_ro);

When the code is run normally (e.g. on a development machine), the no_isa munger is not in effect. When run on a machine with the PERL_FASTER environment variable set to true (e.g. on the production machine), the no_isa munger strings into action, and type constraints cease to be checked. (Because any type errors would have cropped up on the development machines, right??)

OUTPUT

Your machine is probably faster than mine, but a typical output with PERL_FASTER false is:

 Completed run in: 0.002362 s.

And with PERL_FASTER true:

 Completed run in: 0.001246 s.

DEPENDENCIES

Example requires Moose and Types::Standard.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2013 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.