| 1 | package CatalystX::OAuth2::Controller::Role::WithStore; | ||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | # ABSTRACT: A role for providing oauth2 stores to controllers | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 10 | has store => ( | |||||||||||||||||||||||||||
| 7 | does => 'CatalystX::OAuth2::Store', | ||||||||||||||||||||||||||||
| 8 | is => 'ro', | ||||||||||||||||||||||||||||
| 9 | required => 1 | ||||||||||||||||||||||||||||
| 10 | ); | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | around BUILDARGS => sub { | ||||||||||||||||||||||||||||
| 13 | 41 | ▶ | my $orig = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=20.4
| |||||||||||||||||||||||||||||
| 14 | 41 | my $self = shift; | |||||||||||||||||||||||||||
| 15 | 41 | my $args = $self->$orig(@_); | |||||||||||||||||||||||||||
| 16 | 41 | ▶ | return $args unless @_ == 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 41 | my ($app) = @_; | |||||||||||||||||||||||||||
| 18 | 41 | for ( $args->{store} ) { | |||||||||||||||||||||||||||
| 19 | 41 | ▶ | last unless defined and ref eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_ and ref $_ eq "HASH"
MC/DC0%0/2
defined $_ and ref $_ eq "HASH"
defined $_
ref $_ eq "HASH"
Truth table33%1/3
A and B
A= defined $_B= ref $_ eq "HASH"
| |||||||||||||||||||||||||||||
| 20 | 41 | my $store_args = {%$_}; | |||||||||||||||||||||||||||
| 21 | 41 | my $class = delete $store_args->{class}; | |||||||||||||||||||||||||||
| 22 | 41 | ▶ | $class = "CatalystX::OAuth2::Store::$class" unless $class =~ /^\+/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 41 | my ( $is_success, $error ) = Class::Load::try_load_class($class); | |||||||||||||||||||||||||||
| 24 | 41 | ▶ | die qq{Couldn't load OAuth2 store '$class': $error} unless $is_success; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 41 | $args->{store} = $class->new( %$store_args, app => $app ); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | 41 | return $args; | |||||||||||||||||||||||||||
| 28 | 10 | }; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 10 | 1; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | __END__ | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =pod | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =head1 NAME | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | CatalystX::OAuth2::Controller::Role::WithStore - A role for providing oauth2 stores to controllers | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =head1 VERSION | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | version 0.001006 | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | Eden Cardim <edencardim@gmail.com> | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | This software is copyright (c) 2017 by Suretec Systems Ltd. | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 53 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =cut | ||||||||||||||||||||||||||||