From: Charles McGarvey Date: Tue, 10 Mar 2020 04:53:34 +0000 (-0600) Subject: add README X-Git-Tag: v0.002~3 X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-Return-Type-Lexical;a=commitdiff_plain;h=43503e051d101a0e6c2abc1f2ab0f02a32f92ea4 add README --- diff --git a/README.md b/README.md new file mode 100644 index 0000000..8cd9349 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# NAME + +Return::Type::Lexical - Same thing as Return::Type, but lexical + +# VERSION + +version 0.001 + +# SYNOPSIS + + use Return::Type::Lexical; + use Types::Standard qw(Int); + + sub foo :ReturnType(Int) { return "not an int" } + + { + no Return::Type::Lexical; + sub bar :ReturnType(Int) { return "not an int" } + } + + my $foo = foo(); # throws an error + my $bar = bar(); # returns "not an int" + + # Can also be used with Devel::StrictMode to only perform + # type checks in strict mode: + + use Devel::StrictMode; + use Return::Type::Lexical check => STRICT; + +# DESCRIPTION + +This module works just like [Return::Type](https://metacpan.org/pod/Return%3A%3AType), but type-checking can be enabled and disabled within +lexical scopes. + +There is no runtime penalty when type-checking is disabled. + +# METHODS + +## import + +The `check` attribute can be used to set whether or not types are checked. + +# BUGS + +Please report any bugs or feature requests on the bugtracker website +[https://github.com/chazmcgarvey/Return-Type-Lexical/issues](https://github.com/chazmcgarvey/Return-Type-Lexical/issues) + +When submitting a bug or request, please include a test-file or a +patch to an existing test-file that illustrates the bug or desired +feature. + +# AUTHOR + +Charles McGarvey + +# COPYRIGHT AND LICENSE + +This software is copyright (c) 2020 by Charles McGarvey. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself.