blib/lib/CPS/Future.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/CPS/Governor.pm ↑ Summary blib/lib/CPS/Governor/Simple.pm »
1 # You may distribute under the terms of either the GNU General Public License
2 # or the Artistic License (the same terms as Perl itself)
3 #
4 # (C) Paul Evans, 2012 -- leonerd@leonerd.org.uk
5  
6 package CPS::Future;
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.18';
12  
13 1 ▶use base qw( Future );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =head1 NAME
16  
17 C<CPS::Future> - compatibility wrapper around L<Future>
18  
19 =head1 DESCRIPTION
20  
21 This module provides a compatibility wrapper around L<Future>. The code it
22 used to contain was renamed to move it out of the C<CPS> distribution.
23 Existing code that refers to C<CPS::Future> should be changed to use C<Future>
24 instead.
25  
26 =cut
27  
28 =head2 $future->( @result )
29  
30 This subclass overloads the calling operator, so simply invoking the future
31 object itself as if it were a C<CODE> reference is equivalent to calling the
32 C<done> method. This makes it simple to pass as a callback function to other
33 code.
34  
35 It turns out however, that this behaviour is too subtle and can lead to bugs
36 when futures are accidentally used as plain C<CODE> references. See the
37 C<done_cb> method instead. This overload behaviour will be removed in a later
38 version.
39  
40 =cut
41  
42 1 use overload '&{}' => 'done_cb',
43 1 ▶ fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 1 0x55AA;
« blib/lib/CPS/Governor.pm ↑ Summary blib/lib/CPS/Governor/Simple.pm »