File Coverage

blib/lib/Test/Effects/TIME.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Test::Effects::TIME;
2              
3 1     1   891 no if $] >= 5.018, 'warnings', "experimental";
  1         2  
  1         8  
4 1     1   83 use 5.014;
  1         13  
5 1     1   4 use warnings;
  1         2  
  1         91  
6              
7             our $VERSION = '0.000001';
8              
9 1     1   113 sub import { $^H{'Test::Effects::TIME'} = 1; }
10 1     1   1877 sub unimport { $^H{'Test::Effects::TIME'} = 0; }
11              
12              
13             1; # Magic true value required at end of module
14             __END__
15              
16             =head1 NAME
17              
18             Test::Effects::TIME - Lexically set Test::Effects timing option
19              
20              
21             =head1 VERSION
22              
23             This document describes Test::Effects::TIME version 0.000001
24              
25              
26             =head1 SYNOPSIS
27              
28             {
29             use Test::Effects::TIME;
30             # Test::Effects times its tests
31              
32             {
33             no Test::Effects::TIME;
34             # Test::Effects doesn't time its tests here
35             }
36              
37             # Test::Effects reverts to timing its tests again here
38              
39             }
40             # Test::Effects reverts to original (non-timing) behaviour here
41              
42              
43             =head1 DESCRIPTION
44              
45             Using this module changes the default behaviour of Test::Effects's
46             C<effects_ok()> test.
47              
48             Normally this test does not time the code it tests
49             (unless explicitly told otherwise via the use of C<< TIME => 1 >> or
50             C<TIME()>). If this
51             module is used in a code block, C<effects_ok()> defaults to timing
52             its tests for the remainder of that block's lexical scope.
53              
54             Note, however, that an explicit C<< TIME => 0 >> option in
55             any call to C<<effects_ok()> overrides this lexical default.
56              
57             =head1 INTERFACE
58              
59             =head2 C<use Test::Effects::TIME;>
60              
61             C<effects_ok> defaults to timing the code it tests
62             within the rest of the current lexical scope.
63              
64              
65             =head2 C<no Test::Effects::TIME;>
66              
67             C<effects_ok> defaults to not timing the code it tests
68             within the rest of the current lexical scope.
69              
70              
71             =head1 DIAGNOSTICS
72              
73             None.
74              
75              
76             =head1 CONFIGURATION AND ENVIRONMENT
77              
78             Test::Effects::TIME requires no configuration files or environment variables.
79              
80              
81             =head1 DEPENDENCIES
82              
83             Requires Perl 5.14 (or better).
84              
85             Does not require, but is meaningless without, the Test::Effects module.
86              
87              
88             =head1 INCOMPATIBILITIES
89              
90             None reported.
91              
92              
93             =head1 BUGS AND LIMITATIONS
94              
95             No bugs have been reported.
96              
97             Please report any bugs or feature requests to
98             C<bug-lib-test-effects@rt.cpan.org>, or through the web interface at
99             L<http://rt.cpan.org>.
100              
101              
102             =head1 AUTHOR
103              
104             Damian Conway C<< <DCONWAY@cpan.org> >>
105              
106              
107             =head1 LICENCE AND COPYRIGHT
108              
109             Copyright (c) 2012, Damian Conway C<< <DCONWAY@cpan.org> >>. All rights reserved.
110              
111             This module is free software; you can redistribute it and/or
112             modify it under the same terms as Perl itself. See L<perlartistic>.
113              
114              
115             =head1 DISCLAIMER OF WARRANTY
116              
117             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
118             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
119             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
120             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
121             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
122             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
123             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
124             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
125             NECESSARY SERVICING, REPAIR, OR CORRECTION.
126              
127             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
128             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
129             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
130             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
131             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
132             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
133             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
134             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
135             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
136             SUCH DAMAGES.
137