line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Role::Doable; |
2
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
1555
|
use 5.018; |
|
87
|
|
|
|
|
332
|
|
4
|
|
|
|
|
|
|
|
5
|
87
|
|
|
87
|
|
467
|
use strict; |
|
87
|
|
|
|
|
179
|
|
|
87
|
|
|
|
|
1693
|
|
6
|
87
|
|
|
87
|
|
396
|
use warnings; |
|
87
|
|
|
|
|
168
|
|
|
87
|
|
|
|
|
2265
|
|
7
|
|
|
|
|
|
|
|
8
|
87
|
|
|
87
|
|
483
|
use Venus::Role 'with'; |
|
87
|
|
|
|
|
192
|
|
|
87
|
|
|
|
|
536
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# METHODS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub do { |
13
|
235
|
|
|
235
|
1
|
807
|
my ($self, $code, @args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
235
|
|
50
|
0
|
|
598
|
$code ||= sub{}; |
16
|
|
|
|
|
|
|
|
17
|
235
|
|
|
|
|
481
|
local $_ = $self; |
18
|
235
|
|
|
|
|
1047
|
$self->$code(@args); |
19
|
|
|
|
|
|
|
|
20
|
235
|
|
|
|
|
1158
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# EXPORTS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub EXPORT { |
26
|
88
|
|
|
88
|
0
|
325
|
['do'] |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
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(Str | CodeRef $method, Any @args) (Self) |
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> |
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 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 LICENSE |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
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 |