line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Object::Role::Pluggable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
33464
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
5
|
use routines; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
2872
|
use Moo::Role; |
|
1
|
|
|
|
|
10924
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# METHODS |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
1
|
41833
|
method plugin($name, @args) { |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
16
|
1
|
|
|
|
|
1534
|
require Data::Object::Space; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
11656
|
my $space = Data::Object::Space->new(ref $self); |
19
|
1
|
|
|
|
|
13
|
my $plugin = $space->child('plugin')->child($name); |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
194
|
return $plugin->build(@args); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=encoding utf8 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Data::Object::Role::Pluggable |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 ABSTRACT |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Pluggable Role for Perl 5 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
package Example; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use Data::Object::Class; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
with 'Data::Object::Role::Pluggable'; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
package main; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $example = Example->new; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This package provides a mechanism for dispatching to plugin classes. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This package implements the following methods: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 plugin |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
plugin(Str $name, Any @args) : InstanceOf['Data::Object::Plugin'] |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The plugin method returns an instantiated plugin class whose namespace is based |
71
|
|
|
|
|
|
|
on the package name of the calling class and the C<$name> argument provided. If |
72
|
|
|
|
|
|
|
the plugin cannot be loaded this method will cause the program to crash. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item plugin example #1 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# given: synopsis |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Example::Plugin::Formatter; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
use Data::Object::Class; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
extends 'Data::Object::Plugin'; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has name => ( |
87
|
|
|
|
|
|
|
is => 'ro' |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
package main; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$example->plugin(formatter => (name => 'lorem')); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Al Newkirk, C<awncorp@cpan.org> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Copyright (C) 2011-2019, Al Newkirk, et al. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the terms |
107
|
|
|
|
|
|
|
of the The Apache License, Version 2.0, as elucidated in the L<"license |
108
|
|
|
|
|
|
|
file"|https://github.com/iamalnewkirk/data-object-role-functable/blob/master/LICENSE>. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 PROJECT |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
L<Wiki|https://github.com/iamalnewkirk/data-object-role-functable/wiki> |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L<Project|https://github.com/iamalnewkirk/data-object-role-functable> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L<Initiatives|https://github.com/iamalnewkirk/data-object-role-functable/projects> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L<Milestones|https://github.com/iamalnewkirk/data-object-role-functable/milestones> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L<Contributing|https://github.com/iamalnewkirk/data-object-role-functable/blob/master/CONTRIBUTE.md> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L<Issues|https://github.com/iamalnewkirk/data-object-role-functable/issues> |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |