| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Venus::Role::Pluggable; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 33 |  |  | 33 |  | 618 | use 5.018; | 
|  | 33 |  |  |  |  | 149 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 33 |  |  | 33 |  | 229 | use strict; | 
|  | 33 |  |  |  |  | 92 |  | 
|  | 33 |  |  |  |  | 835 |  | 
| 6 | 33 |  |  | 33 |  | 165 | use warnings; | 
|  | 33 |  |  |  |  | 76 |  | 
|  | 33 |  |  |  |  | 978 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 33 |  |  | 33 |  | 196 | use Venus::Role 'fault'; | 
|  | 33 |  |  |  |  | 337 |  | 
|  | 33 |  |  |  |  | 366 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | # AUDITS | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub AUDIT { | 
| 13 | 33 |  |  | 33 | 0 | 144 | my ($self, $from) = @_; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 33 | 50 |  |  |  | 404 | if (!$from->does('Venus::Role::Proxyable')) { | 
| 16 | 0 |  |  |  |  | 0 | fault "${self} requires ${from} to consume Venus::Role::Proxyable"; | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 33 |  |  |  |  | 136 | return $self; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | # METHODS | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | sub build_proxy { | 
| 25 | 2 |  |  | 2 | 0 | 6 | my ($self, $package, $method, @args) = @_; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 2 |  |  |  |  | 683 | require Venus::Space; | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 2 |  |  |  |  | 10 | my $space = Venus::Space->new($package)->child('plugin', $method); | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 2 | 50 |  |  |  | 11 | return undef if !$space->tryload; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | return sub { | 
| 34 | 2 | 100 |  | 2 |  | 84 | if ($space->package->can('construct')) { | 
| 35 | 1 |  |  |  |  | 3 | my $class = $space->load; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 1 |  |  |  |  | 29 | return $class->construct($self, @args)->execute; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  | else { | 
| 40 | 1 |  |  |  |  | 5 | my $class = $space->load; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 1 |  |  |  |  | 12 | return $class->new->execute($self, @args); | 
| 43 |  |  |  |  |  |  | } | 
| 44 | 2 |  |  |  |  | 22 | }; | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | # EXPORTS | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub EXPORT { | 
| 50 | 33 |  |  | 33 | 0 | 162 | ['build_proxy'] | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | 1; | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | =head1 NAME | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | Venus::Role::Pluggable - Pluggable Role | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =cut | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =head1 ABSTRACT | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | Pluggable Role for Perl 5 | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =cut | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | package Example::Plugin::Username; | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | use Venus::Class; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | use Digest::SHA (); | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | sub execute { | 
| 78 |  |  |  |  |  |  | my ($self, $example) = @_; | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | return Digest::SHA::sha1_hex($example->login); | 
| 81 |  |  |  |  |  |  | } | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | package Example::Plugin::Password; | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | use Venus::Class; | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | use Digest::SHA (); | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | attr 'value'; | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | sub construct { | 
| 92 |  |  |  |  |  |  | my ($class, $example) = @_; | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | return $class->new(value => $example->secret); | 
| 95 |  |  |  |  |  |  | } | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | sub execute { | 
| 98 |  |  |  |  |  |  | my ($self) = @_; | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | return Digest::SHA::sha1_hex($self->value); | 
| 101 |  |  |  |  |  |  | } | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | package Example; | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | use Venus::Class; | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | with 'Venus::Role::Proxyable'; | 
| 108 |  |  |  |  |  |  | with 'Venus::Role::Pluggable'; | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | attr 'login'; | 
| 111 |  |  |  |  |  |  | attr 'secret'; | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | package main; | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | my $example = Example->new(login => 'admin', secret => 'p@ssw0rd'); | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | # $example->username; | 
| 118 |  |  |  |  |  |  | # $example->password; | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | =cut | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | This package provides a mechanism for dispatching to plugin classes. | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | =cut | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =head1 AUTHORS | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | Awncorp, C | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =cut | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =head1 LICENSE | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | Copyright (C) 2000, Awncorp, C. | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | This program is free software, you can redistribute it and/or modify it under | 
| 139 |  |  |  |  |  |  | the terms of the Apache license version 2.0. | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =cut |