|
NAMEVenus::Role::Pluggable - Pluggable Role ABSTRACTPluggable Role for Perl 5 SYNOPSIS package Example::Plugin::Username;
use Venus::Class;
use Digest::SHA ();
sub execute {
my ($self, $example) = @_;
return Digest::SHA::sha1_hex($example->login);
}
package Example::Plugin::Password;
use Venus::Class;
use Digest::SHA ();
attr 'value';
sub construct {
my ($class, $example) = @_;
return $class->new(value => $example->secret);
}
sub execute {
my ($self) = @_;
return Digest::SHA::sha1_hex($self->value);
}
package Example;
use Venus::Class;
with 'Venus::Role::Proxyable';
with 'Venus::Role::Pluggable';
attr 'login';
attr 'secret';
package main;
my $example = Example->new(login => 'admin', secret => 'p@ssw0rd');
# $example->username;
# $example->password;
DESCRIPTIONThis package provides a mechanism for dispatching to plugin classes. AUTHORSAwncorp, "awncorp@cpan.org" LICENSECopyright (C) 2022, Awncorp, "awncorp@cpan.org". This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.
|