NAME

Venus::Role::Pluggable - Pluggable Role

ABSTRACT

Pluggable 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;

DESCRIPTION

This package provides a mechanism for dispatching to plugin classes.

AUTHORS

Awncorp, awncorp@cpan.org

LICENSE

Copyright (C) 2000, 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.