blib/lib/Venus/Role/Doable.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 50.0% 1 / 2 totaltotal 81.2% 26 / 32 SCAR 6.9
CC
2
Cov
90%
do
2.1
__ANON__
1.1
BEGIN
1.0
CRAP 2.0
« blib/lib/Venus/Undef.pm ↑ Summary blib/lib/Venus/Role/Patchable.pm »
1 package Venus::Role::Doable;
2  
3 96 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 96 ▶use Venus::Role 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # METHODS
11  
12 sub do {
13 666 ▶ my ($self, $code, @args) = @_;
Subroutine do: called CC=2 SCAR=7.2
Pod documented
14  
15 666 ▶ $code ||= sub{};
Subroutine __ANON__: not called CC=1 SCAR=1.2
Condition33%1/3
$code ||= sub { }
l!l&&r!l&&!r
66600
MC/DC0%0/2
$code ||= sub { }
$code sub { }
Truth table33%1/3
A ||= B
A= $codeB= sub { }
ABresult
1X1
011
000
16  
17 666 local $_ = $self;
18 666 $self->$code(@args);
19  
20 666 return $self;
21 }
22  
23 # EXPORTS
24  
25 sub EXPORT {
26 97 ▶ ['do']
Subroutine EXPORT: called CC=1 SCAR=0.0
Pod undocumented
27 }
28  
29 96 1;
30  
31  
32  
33 =head1 NAME
34  
35 Venus::Role::Doable - Doable Role
36  
37 =cut
38  
39 =head1 ABSTRACT
40  
41 Doable Role for Perl 5
42  
43 =cut
44  
45 =head1 SYNOPSIS
46  
47 package Example;
48  
49 use Venus::Class;
50  
51 with 'Venus::Role::Doable';
52  
53 attr 'time';
54  
55 sub execute {
56 return;
57 }
58  
59 package main;
60  
61 my $example = Example->new;
62  
63 # $example->do(time => time)->execute;
64  
65 =cut
66  
67 =head1 DESCRIPTION
68  
69 This package modifies the consuming package and provides methods for chaining
70 any chainable and non-chainable methods (by ignoring their return values).
71  
72 =cut
73  
74 =head1 METHODS
75  
76 This package provides the following methods:
77  
78 =cut
79  
80 =head2 do
81  
82 do(string | coderef $method, any @args) (object)
83  
84 The do method dispatches the method call or executes the callback and returns
85 the invocant. This method supports dispatching, i.e. providing a method name
86 and arguments whose return value will be acted on by this method.
87  
88 I<Since C<0.01>>
89  
90 =over 4
91  
92 =item do example 1
93  
94 package main;
95  
96 my $example = Example->new;
97  
98 $example = $example->do(time => time);
99  
100 # bless({ time => 0000000000 }, "Example")
101  
102 # $example->execute;
103  
104 =back
105  
106 =cut
107  
108 =head1 AUTHORS
109  
110 Awncorp, C<awncorp@cpan.org>
111  
112 =cut
113  
114 =head1 LICENSE
115  
116 Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>.
117  
118 This program is free software, you can redistribute it and/or modify it under
119 the terms of the Apache license version 2.0.
120  
121 =cut
« blib/lib/Venus/Undef.pm ↑ Summary blib/lib/Venus/Role/Patchable.pm »