line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rethinkdb::Base; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
57
|
use strict; |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
351
|
|
4
|
15
|
|
|
15
|
|
40
|
use warnings; |
|
15
|
|
|
|
|
19
|
|
|
15
|
|
|
|
|
285
|
|
5
|
15
|
|
|
15
|
|
7822
|
use utf8; |
|
15
|
|
|
|
|
117
|
|
|
15
|
|
|
|
|
55
|
|
6
|
15
|
|
|
15
|
|
346
|
use feature (); |
|
15
|
|
|
|
|
15
|
|
|
15
|
|
|
|
|
166
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# No imports because we get subclassed, a lot! |
9
|
15
|
|
|
15
|
|
41
|
use Carp (); |
|
15
|
|
|
|
|
15
|
|
|
15
|
|
|
|
|
145
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Only Perl 5.14+ requires it on demand |
12
|
15
|
|
|
15
|
|
7192
|
use IO::Handle (); |
|
15
|
|
|
|
|
72483
|
|
|
15
|
|
|
|
|
560
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
15
|
615
|
|
|
615
|
|
731
|
my $class = shift; |
16
|
615
|
100
|
|
|
|
134100
|
return unless my $flag = shift; |
17
|
15
|
|
|
15
|
|
73
|
no strict 'refs'; |
|
15
|
|
|
|
|
20
|
|
|
15
|
|
|
|
|
5793
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Base |
20
|
375
|
100
|
|
|
|
675
|
if ( $flag eq '-base' ) { $flag = $class } |
|
330
|
50
|
|
|
|
321
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Strict |
23
|
0
|
|
|
|
|
0
|
elsif ( $flag eq '-strict' ) { $flag = undef } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Module |
26
|
|
|
|
|
|
|
else { |
27
|
45
|
|
|
|
|
61
|
my $file = $flag; |
28
|
45
|
|
|
|
|
321
|
$file =~ s/::|'/\//g; |
29
|
45
|
100
|
|
|
|
7308
|
require "$file.pm" unless $flag->can('new'); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ISA |
33
|
375
|
50
|
|
|
|
582
|
if ($flag) { |
34
|
375
|
|
|
|
|
486
|
my $caller = caller; |
35
|
375
|
|
|
|
|
313
|
push @{"${caller}::ISA"}, $flag; |
|
375
|
|
|
|
|
2908
|
|
36
|
375
|
|
|
3690
|
|
1100
|
*{"${caller}::has"} = sub { attr( $caller, @_ ) }; |
|
375
|
|
|
|
|
1207
|
|
|
3690
|
|
|
|
|
5694
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Mojo modules are strict! |
40
|
375
|
|
|
|
|
1319
|
strict->import; |
41
|
375
|
|
|
|
|
2535
|
warnings->import; |
42
|
375
|
|
|
|
|
893
|
utf8->import; |
43
|
375
|
|
|
|
|
37009
|
feature->import(':5.10'); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
15
|
|
|
15
|
1
|
38
|
my $class = shift; |
48
|
15
|
0
|
33
|
|
|
147
|
bless @_ ? @_ > 1 ? {@_} : { %{ $_[0] } } : {}, ref $class || $class; |
|
0
|
50
|
|
|
|
0
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Performance is very important for something as often used as accessors, |
52
|
|
|
|
|
|
|
# so we optimize them by compiling our own code, don't be scared, we have |
53
|
|
|
|
|
|
|
# tests for every single case |
54
|
|
|
|
|
|
|
sub attr { |
55
|
3690
|
|
|
3690
|
1
|
4032
|
my ( $class, $attrs, $default ) = @_; |
56
|
3690
|
50
|
33
|
|
|
17113
|
return unless ( $class = ref $class || $class ) && $attrs; |
|
|
|
33
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
3690
|
50
|
66
|
|
|
6126
|
Carp::croak 'Default has to be a code reference or constant value' |
59
|
|
|
|
|
|
|
if ref $default && ref $default ne 'CODE'; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Compile attributes |
62
|
3690
|
100
|
|
|
|
2736
|
for my $attr ( @{ ref $attrs eq 'ARRAY' ? $attrs : [$attrs] } ) { |
|
3690
|
|
|
|
|
8722
|
|
63
|
3915
|
50
|
|
|
|
9660
|
Carp::croak qq{Attribute "$attr" invalid} unless $attr =~ /^[a-zA-Z_]\w*$/; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Header (check arguments) |
66
|
3915
|
|
|
|
|
6541
|
my $code = "package $class;\nsub $attr {\n if (\@_ == 1) {\n"; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# No default value (return value) |
69
|
3915
|
100
|
|
|
|
4692
|
unless ( defined $default ) { $code .= " return \$_[0]{'$attr'};" } |
|
330
|
|
|
|
|
454
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Default value |
72
|
|
|
|
|
|
|
else { |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Return value |
75
|
3585
|
|
|
|
|
4264
|
$code .= " return \$_[0]{'$attr'} if exists \$_[0]{'$attr'};\n"; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Return default value |
78
|
3585
|
|
|
|
|
3225
|
$code .= " return \$_[0]{'$attr'} = "; |
79
|
3585
|
100
|
|
|
|
4928
|
$code .= ref $default eq 'CODE' ? '$default->($_[0]);' : '$default;'; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Store value |
83
|
3915
|
|
|
|
|
3861
|
$code .= "\n }\n \$_[0]{'$attr'} = \$_[1];\n"; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Footer (return invocant) |
86
|
3915
|
|
|
|
|
2669
|
$code .= " \$_[0];\n}"; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# We compile custom attribute code for speed |
89
|
15
|
|
|
15
|
|
71
|
no strict 'refs'; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
2108
|
|
90
|
3915
|
50
|
|
|
|
5626
|
warn "-- Attribute $attr in $class\n$code\n\n" if $ENV{RDB_BASE_DEBUG}; |
91
|
3915
|
50
|
|
0
|
1
|
365539
|
Carp::croak "Rethinkdb::Base error: $@" unless eval "$code;1"; |
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
1
|
|
|
|
0
|
0
|
|
0
|
|
|
|
|
0
|
0
|
|
0
|
|
|
|
|
0
|
0
|
|
0
|
|
|
|
|
0
|
0
|
|
0
|
|
|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
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub tap { |
96
|
0
|
|
|
0
|
1
|
|
my ( $self, $cb ) = @_; |
97
|
0
|
|
|
|
|
|
$_->$cb for $self; |
98
|
0
|
|
|
|
|
|
return $self; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Rethinkdb::Base - Minimal base class |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SYNOPSIS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
package Cat; |
110
|
|
|
|
|
|
|
use Rethinkdb::Base -base; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has name => 'Nyan'; |
113
|
|
|
|
|
|
|
has [qw(birds mice)] => 2; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
package Tiger; |
116
|
|
|
|
|
|
|
use Rethinkdb::Base 'Cat'; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
has friend => sub { Cat->new }; |
119
|
|
|
|
|
|
|
has stripes => 42; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
package main; |
122
|
|
|
|
|
|
|
use Rethinkdb::Base -strict; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $mew = Cat->new(name => 'Longcat'); |
125
|
|
|
|
|
|
|
say $mew->mice; |
126
|
|
|
|
|
|
|
say $mew->mice(3)->birds(4)->mice; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
my $rawr = Tiger->new(stripes => 23, mice => 0); |
129
|
|
|
|
|
|
|
say $rawr->tap(sub { $_->friend->name('Tacgnol') })->mice; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 DESCRIPTION |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
L is a simple base class. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features |
136
|
|
|
|
|
|
|
use Rethinkdb::Base -strict; |
137
|
|
|
|
|
|
|
use Rethinkdb::Base -base; |
138
|
|
|
|
|
|
|
use Rethinkdb::Base 'SomeBaseClass'; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
All three forms save a lot of typing. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# use Rethinkdb::Base -strict; |
143
|
|
|
|
|
|
|
use strict; |
144
|
|
|
|
|
|
|
use warnings; |
145
|
|
|
|
|
|
|
use utf8; |
146
|
|
|
|
|
|
|
use feature ':5.10'; |
147
|
|
|
|
|
|
|
use IO::Handle (); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# use Rethinkdb::Base -base; |
150
|
|
|
|
|
|
|
use strict; |
151
|
|
|
|
|
|
|
use warnings; |
152
|
|
|
|
|
|
|
use utf8; |
153
|
|
|
|
|
|
|
use feature ':5.10'; |
154
|
|
|
|
|
|
|
use IO::Handle (); |
155
|
|
|
|
|
|
|
use Rethinkdb::Base; |
156
|
|
|
|
|
|
|
push @ISA, 'Rethinkdb::Base'; |
157
|
|
|
|
|
|
|
sub has { Rethinkdb::Base::attr(__PACKAGE__, @_) } |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# use Rethinkdb::Base 'SomeBaseClass'; |
160
|
|
|
|
|
|
|
use strict; |
161
|
|
|
|
|
|
|
use warnings; |
162
|
|
|
|
|
|
|
use utf8; |
163
|
|
|
|
|
|
|
use feature ':5.10'; |
164
|
|
|
|
|
|
|
use IO::Handle (); |
165
|
|
|
|
|
|
|
require SomeBaseClass; |
166
|
|
|
|
|
|
|
push @ISA, 'SomeBaseClass'; |
167
|
|
|
|
|
|
|
use Rethinkdb::Base; |
168
|
|
|
|
|
|
|
sub has { Rethinkdb::Base::attr(__PACKAGE__, @_) } |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 FUNCTIONS |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
L exports the following functions if imported with the C<-base> |
173
|
|
|
|
|
|
|
flag or a base class. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 has |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
has 'name'; |
178
|
|
|
|
|
|
|
has [qw(name1 name2 name3)]; |
179
|
|
|
|
|
|
|
has name => 'foo'; |
180
|
|
|
|
|
|
|
has name => sub {...}; |
181
|
|
|
|
|
|
|
has [qw(name1 name2 name3)] => 'foo'; |
182
|
|
|
|
|
|
|
has [qw(name1 name2 name3)] => sub {...}; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Create attributes for hash-based objects, just like the C method. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 METHODS |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
L implements the following methods. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 new |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
my $object = BaseSubClass->new; |
193
|
|
|
|
|
|
|
my $object = BaseSubClass->new(name => 'value'); |
194
|
|
|
|
|
|
|
my $object = BaseSubClass->new({name => 'value'}); |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This base class provides a basic constructor for hash-based objects. You can |
197
|
|
|
|
|
|
|
pass it either a hash or a hash reference with attribute values. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 attr |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
$object->attr('name'); |
202
|
|
|
|
|
|
|
BaseSubClass->attr('name'); |
203
|
|
|
|
|
|
|
BaseSubClass->attr([qw(name1 name2 name3)]); |
204
|
|
|
|
|
|
|
BaseSubClass->attr(name => 'foo'); |
205
|
|
|
|
|
|
|
BaseSubClass->attr(name => sub {...}); |
206
|
|
|
|
|
|
|
BaseSubClass->attr([qw(name1 name2 name3)] => 'foo'); |
207
|
|
|
|
|
|
|
BaseSubClass->attr([qw(name1 name2 name3)] => sub {...}); |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Create attribute accessor for hash-based objects, an array reference can be |
210
|
|
|
|
|
|
|
used to create more than one at a time. Pass an optional second argument to |
211
|
|
|
|
|
|
|
set a default value, it should be a constant or a callback. The callback will |
212
|
|
|
|
|
|
|
be excuted at accessor read time if there's no set value. Accessors can be |
213
|
|
|
|
|
|
|
chained, that means they return their invocant when they are called with an |
214
|
|
|
|
|
|
|
argument. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 tap |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
$object = $object->tap(sub {...}); |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
K combinator, tap into a method chain to perform operations on an object |
221
|
|
|
|
|
|
|
within the chain. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 DEBUGGING |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
You can set the RDB_BASE_DEBUG environment variable to get some advanced |
226
|
|
|
|
|
|
|
diagnostics information printed to C. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
RDB_BASE_DEBUG=1 |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
This package was taken from the Mojolicious project. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Copyright (C) 2008-2013, Sebastian Riedel. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 SEE ALSO |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
L, L, L. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |