From: Tomas Doran Date: Thu, 23 Jul 2009 00:22:37 +0000 (+0000) Subject: Type checking, we're only constructed once per app, so lets blow up nicely at the... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b42cdcea556e5ba06e1024c64f560823affcf8d9;p=catagits%2FCatalyst-Authentication-Credential-FBConnect.git Type checking, we're only constructed once per app, so lets blow up nicely at the start if the config looks like bullshit --- diff --git a/Makefile.PL b/Makefile.PL index 5e04a94..f149c00 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,6 +3,8 @@ use inc::Module::Install; name 'Catalyst-Authentication-Credential-FBConnect'; all_from 'lib/Catalyst/Authentication/Credential/FBConnect.pm'; +requires 'MooseX::Types'; +requires 'MooseX::Types::Common'; requires 'namespace::autoclean'; requires 'WWW::Facebook::API'; requires 'Moose'; diff --git a/lib/Catalyst/Authentication/Credential/FBConnect.pm b/lib/Catalyst/Authentication/Credential/FBConnect.pm index bada55e..6d549ef 100644 --- a/lib/Catalyst/Authentication/Credential/FBConnect.pm +++ b/lib/Catalyst/Authentication/Credential/FBConnect.pm @@ -1,26 +1,21 @@ package Catalyst::Authentication::Credential::FBConnect; use Moose; -use namespace::autoclean; - -has debug => ( is => 'ro' ); -has key => ( is => 'ro' ); -has secret => ( is => 'ro' ); -has app_name => ( is => 'ro' ); -has fbconnect => ( is => 'ro', lazy_build => 1, init_arg => undef ); - -has realm => ( is => 'ro', required => 1, weak_ref => 1 ); - +use MooseX::Types::Moose qw/ Bool /; +use MooseX::Types::Common::String qw/ NonEmptySimpleStr /; use WWW::Facebook::API; use Catalyst::Exception (); +use namespace::autoclean; + +has debug => ( is => 'ro', isa => Bool, ); +has key => ( is => 'ro', isa => NonEmptySimpleStr, required => 1 ); +has secret => ( is => 'ro', isa => NonEmptySimpleStr, required => 1 ); +has app_name => ( is => 'ro', isa => NonEmptySimpleStr, required => 1 ); +has fbconnect => ( is => 'ro', lazy_build => 1, init_arg => undef, isa => 'WWW::Facebook::API' ); sub BUILDARGS { my ($class, $config, $c, $realm) = @_; - return { - %{ $config }, - %{ $realm->{config} }, # Ewww, gross hack to steal the realms config too. - realm => $realm, - }; + return $config; } sub BUILD {