Venus/Role/Pluggable.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 90.3% 28 / 31 CC 2 SCAR 2.2
CC
2
Cov
95%
build_proxy
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Venus/Role/Matchable.pm ↑ Summary Venus/Role/Valuable.pm »
1 package Venus::Role::Pluggable;
2  
3 26 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 26 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 26 ▶use Venus::Role 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 26 with 'Venus::Role::Proxyable';
11  
12 # METHODS
13  
14 sub build_proxy {
15 1 ▶ my ($self, $package, $method, @args) = @_;
Subroutine build_proxy: called CC=2 SCAR=7.0
Pod undocumented
16  
17 1 require Venus::Space;
18  
19 1 my $space = Venus::Space->new($package)->child('plugin', $method);
20  
21 1 ▶ return undef if !$space->tryload;
Branch: 1 branch
BranchTrueFalseTotal
unless $space->tryload 0 1 1
22  
23 return sub {
24 1 ▶ return $space->build->execute($self, @args);
Subroutine __ANON__: called CC=1 SCAR=0.0
25 1 };
26 }
27  
28 # EXPORTS
29  
30 sub EXPORT {
31 26 ▶ ['AUTOLOAD', 'BUILDPROXY', 'build_proxy']
Subroutine EXPORT: called CC=1 SCAR=0.0
Pod undocumented
32 }
33  
34 26 1;
35  
36  
37  
38 =head1 NAME
39  
40 Venus::Role::Pluggable - Pluggable Role
41  
42 =cut
43  
44 =head1 ABSTRACT
45  
46 Pluggable Role for Perl 5
47  
48 =cut
49  
50 =head1 SYNOPSIS
51  
52 package Example::Plugin::Password;
53  
54 use Venus::Class;
55  
56 use Digest::SHA ();
57  
58 sub execute {
59 my ($self, $example) = @_;
60  
61 return Digest::SHA::sha1_hex($example->secret);
62 }
63  
64 package Example;
65  
66 use Venus::Class;
67  
68 with 'Venus::Role::Pluggable';
69  
70 attr 'secret';
71  
72 package main;
73  
74 my $example = Example->new(secret => rand);
75  
76 # $example->password;
77  
78 =cut
79  
80 =head1 DESCRIPTION
81  
82 This package provides a mechanism for dispatching to plugin classes.
83  
84 =cut
85  
86 =head1 INTEGRATES
87  
88 This package integrates behaviors from:
89  
90 L<Venus::Role::Proxyable>
91  
92 =cut
« Venus/Role/Matchable.pm ↑ Summary Venus/Role/Valuable.pm »