NAME

Net::OAuth2::Scheme::Option::Builder - poor man's mixin/role closure builder

VERSION

version 0.03

SYNOPSIS

  use parent Net::OAuth2::TokenType::Option::Builder;

  Define_Group gearshift => tenspeed,
    qw(gearshift_doshift gearshift_coast);

  sub pkg_gearshift_tenspeed {
    my $self = shift;
    my $count = $self->uses(gearcount);
    $self->install(gearshift_doshift => sub {
       ...
    }
    $self->install(gearshift_coast => sub {
       ...
    }
  }

  sub pkg_gearshift_sturmey_archer {
    ...
  }

DESCRIPTION

 buh.

METHODS

install (name => $value)

Installs a value for option name.

uses (name[, $default])

Gets the value for option name.

If no value has yet been intalled, installs a default value if one has been specified either here ($default) or elsewhere (e.g., using the defaults group or Define_value)

Otherwise, name must be part of some group, so we see which implementation for that group has been chosen and invoke it to set name (and whatever else) so that we can get a value.

export 'name'

Does uses('name') then adds 'name' to the list of exported options.

ensure (name => $value)

Does uses(name => $value) then dies if option name does not, in fact, have the value $value.

uses_all (<qw( name1 name2 ... )>)

Equivalent to uses(name1), uses(name2), etc..., returning the list of corresponding values.

uses_param
uses_params
croak ($msg)

Like Carp::croak but only for errors that are clearly the result of mistakes in option settings.

AUTHOR

Roger Crew <crew@cs.stanford.edu>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Roger Crew.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.