]> Dogcows Code - chaz/p5-Return-Type-Lexical/blob - README.md
add code comment
[chaz/p5-Return-Type-Lexical] / README.md
1 # NAME
2
3 Return::Type::Lexical - Same thing as Return::Type, but lexical
4
5 # VERSION
6
7 version 0.001
8
9 # SYNOPSIS
10
11 use Return::Type::Lexical;
12 use Types::Standard qw(Int);
13
14 sub foo :ReturnType(Int) { return "not an int" }
15
16 {
17 no Return::Type::Lexical;
18 sub bar :ReturnType(Int) { return "not an int" }
19 }
20
21 my $foo = foo(); # throws an error
22 my $bar = bar(); # returns "not an int"
23
24 # Can also be used with Devel::StrictMode to only perform
25 # type checks in strict mode:
26
27 use Devel::StrictMode;
28 use Return::Type::Lexical check => STRICT;
29
30 # DESCRIPTION
31
32 This module works just like [Return::Type](https://metacpan.org/pod/Return%3A%3AType), but type-checking can be enabled and disabled within
33 lexical scopes.
34
35 There is no runtime penalty when type-checking is disabled.
36
37 # METHODS
38
39 ## import
40
41 The `check` attribute can be used to set whether or not types are checked.
42
43 # BUGS
44
45 Please report any bugs or feature requests on the bugtracker website
46 [https://github.com/chazmcgarvey/Return-Type-Lexical/issues](https://github.com/chazmcgarvey/Return-Type-Lexical/issues)
47
48 When submitting a bug or request, please include a test-file or a
49 patch to an existing test-file that illustrates the bug or desired
50 feature.
51
52 # AUTHOR
53
54 Charles McGarvey <chazmcgarvey@brokenzipper.com>
55
56 # COPYRIGHT AND LICENSE
57
58 This software is copyright (c) 2020 by Charles McGarvey.
59
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
This page took 0.038196 seconds and 4 git commands to generate.