From 7b95ebecffd96c3549222fc05022b9cc42d82b1b Mon Sep 17 00:00:00 2001 From: Amiri Barksdale at Home Date: Thu, 25 Oct 2018 11:51:32 -0700 Subject: [PATCH 1/2] Convert to Moose, remove trailing spaces --- Changes | 5 ++- eg/login.psgi | 2 +- eg/spreadsheets.psgi | 2 +- lib/Net/Google/DataAPI.pm | 38 +++++++++---------- lib/Net/Google/DataAPI/Auth/AuthSub.pm | 4 +- .../DataAPI/Auth/ClientLogin/Multiple.pm | 4 +- lib/Net/Google/DataAPI/Auth/Null.pm | 4 +- lib/Net/Google/DataAPI/Auth/OAuth.pm | 26 ++++++------- lib/Net/Google/DataAPI/Auth/OAuth2.pm | 10 ++--- lib/Net/Google/DataAPI/Role/Auth.pm | 4 +- lib/Net/Google/DataAPI/Role/Entry.pm | 6 +-- lib/Net/Google/DataAPI/Role/HasContent.pm | 6 +-- lib/Net/Google/DataAPI/Role/Service.pm | 22 +++++------ lib/Net/Google/DataAPI/Types.pm | 7 ++-- t/01_role/01_service/01_instanciate.t | 2 +- t/01_role/01_service/02_namespace.t | 2 +- t/01_role/01_service/03_request.t | 6 +-- t/01_role/01_service/04_methods.t | 4 +- t/01_role/01_service/06_pass_through.t | 2 +- t/01_role/02_entry/01_instanciate.t | 4 +- t/01_role/02_entry/02_update.t | 18 ++++----- t/01_role/03_has_content/01_basic.t | 2 +- t/02_feedurl/02_add.t | 2 +- t/02_feedurl/03_list.t | 4 +- t/02_feedurl/04_delete.t | 2 +- t/02_feedurl/05_error.t | 14 +++---- t/03_entry_has/01_basic.t | 20 +++++----- t/03_entry_has/02_error.t | 2 +- t/04_auth/02_oauth.t | 16 ++++---- t/04_auth/04_oauth2.t | 5 ++- t/05_types.t | 2 +- t/lib/MyService.pm | 6 +-- t/lib/MyService/MyEntry.pm | 4 +- xt/perlcriticrc | 4 +- 34 files changed, 133 insertions(+), 128 deletions(-) diff --git a/Changes b/Changes index 4220324..d11cb51 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension Net::Google::DataAPI +0.2806 Thu Oct 25 11:49:00 2018 + - Convert from Any::Moose to Moose, remove trailing spaces. + 0.2805 Sat Jun 28 17:30:00 2014 - allow state parameter for Net::Google::DataAPI::Auth::OAuth2 @@ -69,7 +72,7 @@ Revision history for Perl extension Net::Google::DataAPI 0.19 Mon Jun 07 12:27:00 2010 - - make 'lazy_build' the content property of Role::HasContent + - make 'lazy_build' the content property of Role::HasContent 0.18 Sun May 16 10:08:00 2010 diff --git a/eg/login.psgi b/eg/login.psgi index 47f2f14..cfe688b 100644 --- a/eg/login.psgi +++ b/eg/login.psgi @@ -57,7 +57,7 @@ get '/callback' => sub { my ($c) = @_; if ($c->req->param('error')) { return $c->render('error.tt'); - } + } my $code = $c->req->param('code') or return $c->redirect($c->uri_for('/')); my $oauth2 = oauth2(); diff --git a/eg/spreadsheets.psgi b/eg/spreadsheets.psgi index dfc2b93..7972878 100644 --- a/eg/spreadsheets.psgi +++ b/eg/spreadsheets.psgi @@ -69,7 +69,7 @@ get '/callback' => sub { my ($c) = @_; if ($c->req->param('error')) { return $c->render('error.tt'); - } + } my $code = $c->req->param('code') or return $c->redirect($c->uri_for('/')); my $state = $c->session->get('state') diff --git a/lib/Net/Google/DataAPI.pm b/lib/Net/Google/DataAPI.pm index 1df6ccf..a90b421 100644 --- a/lib/Net/Google/DataAPI.pm +++ b/lib/Net/Google/DataAPI.pm @@ -1,13 +1,14 @@ package Net::Google::DataAPI; use 5.008001; -use Any::Moose; -use Any::Moose '::Exporter'; +use Moose; +use Moose::Exporter; use Carp; use Lingua::EN::Inflect::Number qw(to_PL); use XML::Atom; -our $VERSION = '0.2805'; +use Class::Load ':all'; +our $VERSION = '0.2806'; -any_moose('::Exporter')->setup_import_methods( +Moose::Exporter->setup_import_methods( as_is => ['feedurl', 'entry_has'], ); @@ -16,7 +17,7 @@ sub feedurl { my $class = caller; - my $entry_class = delete $args{entry_class} + my $entry_class = delete $args{entry_class} or confess 'entry_class not specified'; my $can_add = delete $args{can_add}; @@ -41,7 +42,7 @@ sub feedurl { my $attr_name = "${name}_feedurl"; - my $class_meta = any_moose('::Meta::Class')->initialize($class); + my $class_meta = Moose::Meta::Class->initialize($class); $class_meta->add_attribute( $attr_name => ( isa => 'Str', @@ -57,13 +58,13 @@ sub feedurl { $class_meta->add_method( "_build_$attr_name" => sub { my $self = shift; - return $rel ? + return $rel ? [ map { $_->href } grep { $_->rel eq $rel } $self->atom->link ]->[0] : - $as_content_src ? + $as_content_src ? $self->atom->content->elem->getAttribute('src') : $from_atom ? $from_atom->($self, $self->atom) : $default; @@ -76,9 +77,9 @@ sub feedurl { "add_$name" => sub { my ($self, $args) = @_; $self->$attr_name or confess "$attr_name is not set"; - Any::Moose::load_class($entry_class); + load_class($entry_class); $args = $arg_builder->($self, $args); - my %parent = + my %parent = $self->can('sync') ? ( container => $self ) : ( service => $self ); my $entry = $entry_class->new( @@ -105,7 +106,7 @@ sub feedurl { $cond; } else { $self->$attr_name or confess "$attr_name is not set"; - Any::Moose::load_class($entry_class); + load_class($entry_class); $self->can("${name}_feed")->($self, $cond); } }; @@ -139,8 +140,8 @@ sub entry_has { my ($name, %args) = @_; my $class = caller; - my $class_meta = any_moose('::Meta::Class')->initialize($class); - $class_meta->does_role('Net::Google::DataAPI::Role::Entry') + my $class_meta = Moose::Meta::Class->initialize($class); + $class_meta->does_role('Net::Google::DataAPI::Role::Entry') or confess 'Net::Google::DataAPI::Role::Entry required to use entry_has'; my $tagname = delete $args{tagname}; @@ -205,8 +206,7 @@ sub entry_has { } __PACKAGE__->meta->make_immutable; -no Any::Moose; -no Any::Moose '::Exporter'; +no Moose; 1; __END__ @@ -218,7 +218,7 @@ Net::Google::DataAPI - Base implementations for modules to negotiate with Google =head1 SYNOPSIS package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; @@ -252,7 +252,7 @@ Net::Google::DataAPI - Base implementations for modules to negotiate with Google 1; package MyEntry; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; @@ -269,13 +269,13 @@ Net::Google::DataAPI - Base implementations for modules to negotiate with Google =head1 DESCRIPTION -Net::Google::DataAPI is base implementations for modules to negotiate with Google Data APIs. +Net::Google::DataAPI is base implementations for modules to negotiate with Google Data APIs. =head1 METHODS =head2 feedurl -define a feed url. +define a feed url. =head2 entry_has diff --git a/lib/Net/Google/DataAPI/Auth/AuthSub.pm b/lib/Net/Google/DataAPI/Auth/AuthSub.pm index bf12b93..7724a44 100644 --- a/lib/Net/Google/DataAPI/Auth/AuthSub.pm +++ b/lib/Net/Google/DataAPI/Auth/AuthSub.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Auth::AuthSub; -use Any::Moose; +use Moose; with 'Net::Google::DataAPI::Role::Auth'; use Net::Google::AuthSub; use URI; @@ -20,6 +20,6 @@ sub sign_request { __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; 1; diff --git a/lib/Net/Google/DataAPI/Auth/ClientLogin/Multiple.pm b/lib/Net/Google/DataAPI/Auth/ClientLogin/Multiple.pm index b00e714..b36f550 100644 --- a/lib/Net/Google/DataAPI/Auth/ClientLogin/Multiple.pm +++ b/lib/Net/Google/DataAPI/Auth/ClientLogin/Multiple.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Auth::ClientLogin::Multiple; -use Any::Moose; +use Moose; use Net::Google::AuthSub; use Text::Glob; with 'Net::Google::DataAPI::Role::Auth'; @@ -47,7 +47,7 @@ sub _get_auth_params { __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; 1; __END__ diff --git a/lib/Net/Google/DataAPI/Auth/Null.pm b/lib/Net/Google/DataAPI/Auth/Null.pm index 2bd72b3..ee4a5b7 100644 --- a/lib/Net/Google/DataAPI/Auth/Null.pm +++ b/lib/Net/Google/DataAPI/Auth/Null.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Auth::Null; -use Any::Moose; +use Moose; with 'Net::Google::DataAPI::Role::Auth'; our $VERSION = '0.02'; @@ -7,6 +7,6 @@ our $VERSION = '0.02'; sub sign_request {$_[1]}; __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; 1; diff --git a/lib/Net/Google/DataAPI/Auth/OAuth.pm b/lib/Net/Google/DataAPI/Auth/OAuth.pm index de21e73..3620d02 100644 --- a/lib/Net/Google/DataAPI/Auth/OAuth.pm +++ b/lib/Net/Google/DataAPI/Auth/OAuth.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Auth::OAuth; -use Any::Moose; +use Moose; use Net::Google::DataAPI::Types; with 'Net::Google::DataAPI::Role::Auth'; use Digest::SHA1; @@ -12,17 +12,17 @@ our $VERSION = '0.05'; has [qw(consumer_key consumer_secret)] => ( is => 'ro', isa => 'Str', required => 1 ); for my $attr (qw( - request_token + request_token request_token_secret - access_token + access_token access_token_secret -)) { - has $attr => ( - is => 'rw', - isa => 'Str', - clearer => "clear_$attr", - predicate => "has_$attr" - ); +)) { + has $attr => ( + is => 'rw', + isa => 'Str', + clearer => "clear_$attr", + predicate => "has_$attr" + ); } has scope => ( is => 'ro', isa => 'ArrayRef[Str]', required => 1, auto_deref => 1 ); @@ -32,7 +32,7 @@ has authorize_token_hd => ( is => 'ro', isa => 'Str', default => 'default' ); has authorize_token_hl => ( is => 'ro', isa => 'Str', default => 'en' ); has mobile => ( is => 'ro', isa => 'Bool', default => 0 ); has ua => ( is => 'ro', isa => 'LWP::UserAgent', required => 1, lazy_build => 1 ); -sub _build_ua { +sub _build_ua { LWP::UserAgent->new( max_redirect => 0 ); } @@ -50,7 +50,7 @@ sub get_request_token { my ($self, $args) = @_; my $res = $self->_oauth_request( 'request token', - { + { request_url => $self->get_request_token_url, extra_params => { scope => join(' ', $self->scope), @@ -146,7 +146,7 @@ sub sign_request { } __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; 1; __END__ diff --git a/lib/Net/Google/DataAPI/Auth/OAuth2.pm b/lib/Net/Google/DataAPI/Auth/OAuth2.pm index 45e5911..5a8d2af 100644 --- a/lib/Net/Google/DataAPI/Auth/OAuth2.pm +++ b/lib/Net/Google/DataAPI/Auth/OAuth2.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Auth::OAuth2; -use Any::Moose; +use Moose; use Net::Google::DataAPI::Types; with 'Net::Google::DataAPI::Role::Auth'; use Net::OAuth2::Client; @@ -11,7 +11,7 @@ has [qw(client_id client_secret)] => (is => 'ro', isa => 'Str', required => 1); has redirect_uri => (is => 'ro', isa => 'Str', default => 'urn:ietf:wg:oauth:2.0:oob'); has scope => (is => 'ro', isa => 'ArrayRef[Str]', required => 1, auto_deref => 1, default => sub {[ - 'https://www.googleapis.com/auth/userinfo.profile', + 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email' ]}, ); @@ -35,7 +35,7 @@ sub _build_oauth2_client { has oauth2_webserver => (is => 'ro', isa => 'Net::OAuth2::Profile::WebServer', required => 1, lazy_build => 1); sub _build_oauth2_webserver { my $self = shift; - $self->oauth2_client->web_server( + $self->oauth2_client->web_server( redirect_uri => $self->redirect_uri, state => $self->state, ); @@ -89,7 +89,7 @@ sub sign_request { } __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; 1; __END__ @@ -180,7 +180,7 @@ Nobuo Danjou Edanjou@soffritto.orgE L -L +L you can see sample implementations for oauth2 client both as installed and web app in the eg directory of this distribution. diff --git a/lib/Net/Google/DataAPI/Role/Auth.pm b/lib/Net/Google/DataAPI/Role/Auth.pm index 658209f..ccfb47a 100644 --- a/lib/Net/Google/DataAPI/Role/Auth.pm +++ b/lib/Net/Google/DataAPI/Role/Auth.pm @@ -1,7 +1,7 @@ package Net::Google::DataAPI::Role::Auth; -use Any::Moose '::Role'; +use Moose::Role; requires 'sign_request'; -no Any::Moose '::Role'; +no Moose::Role; our $VERSION = '0.02'; 1; diff --git a/lib/Net/Google/DataAPI/Role/Entry.pm b/lib/Net/Google/DataAPI/Role/Entry.pm index c3edcb4..a49bfa6 100644 --- a/lib/Net/Google/DataAPI/Role/Entry.pm +++ b/lib/Net/Google/DataAPI/Role/Entry.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Role::Entry; -use Any::Moose '::Role'; +use Moose::Role; use Carp; use XML::Atom; use XML::Atom::Entry; @@ -133,7 +133,7 @@ sub delete { return $res->is_success; } -no Any::Moose '::Role'; +no Moose::Role; 1; @@ -148,7 +148,7 @@ Net::Google::DataAPI::Role::Entry - represents entry of Google Data API =head1 SYNOPSIS package MyEntry; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; diff --git a/lib/Net/Google/DataAPI/Role/HasContent.pm b/lib/Net/Google/DataAPI/Role/HasContent.pm index 257c37c..78bead3 100644 --- a/lib/Net/Google/DataAPI/Role/HasContent.pm +++ b/lib/Net/Google/DataAPI/Role/HasContent.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Role::HasContent; -use Any::Moose '::Role'; +use Moose::Role; our $VERSION='0.03'; requires 'update'; @@ -28,7 +28,7 @@ sub param { } } -no Any::Moose '::Role'; +no Moose::Role; 1; @@ -43,7 +43,7 @@ Net::Google::DataAPI::Role::HasContent - provides 'param' method to Entry =head1 SYNOPSIS package MyEntry; - use Any::Moose; + use Moose; with qw( Net::Google::DataAPI::Role::Entry Net::Google::DataAPI::Role::HasContent diff --git a/lib/Net/Google/DataAPI/Role/Service.pm b/lib/Net/Google/DataAPI/Role/Service.pm index 15642cb..658a366 100644 --- a/lib/Net/Google/DataAPI/Role/Service.pm +++ b/lib/Net/Google/DataAPI/Role/Service.pm @@ -1,5 +1,5 @@ package Net::Google::DataAPI::Role::Service; -use Any::Moose '::Role'; +use Moose::Role; use Carp; use LWP::UserAgent; use URI; @@ -101,8 +101,8 @@ sub request { } if ($@ || $res->is_error) { confess sprintf( - "request for '%s' failed:\n\t%s\n\t%s\n\t", - $uri, + "request for '%s' failed:\n\t%s\n\t%s\n\t", + $uri, ($res ? $res->status_line : $@), ($res ? $res->content : $!), ); @@ -112,14 +112,14 @@ sub request { if ($res->content_length && $type !~ m{^application/atom\+xml}) { confess sprintf( "Content-Type of response for '%s' is not 'application/atom+xml': %s", - $uri, + $uri, $type ); } my $obj = eval {$res_obj->new(\($res->content))}; confess sprintf( - "response for '%s' is broken: %s", - $uri, + "response for '%s' is broken: %s", + $uri, $@ ) if $@; return $obj; @@ -138,7 +138,7 @@ sub prepare_request { my @existing_query = $uri->query_form; $uri->query_form( { - @existing_query, + @existing_query, %{$args->{query}} } ) if $args->{query}; @@ -146,7 +146,7 @@ sub prepare_request { if (my $parts = $args->{parts}) { $req->header('Content-Type' => 'multipart/related'); for my $part (@$parts) { - ref $part eq 'HTTP::Message' + ref $part eq 'HTTP::Message' or confess "part argument should be a HTTP::Message object"; $req->add_part($part); } @@ -222,7 +222,7 @@ sub delete { return $res; } -no Any::Moose '::Role'; +no Moose::Role; 1; @@ -232,12 +232,12 @@ __END__ =head1 NAME -Net::Google::DataAPI::Role::Service - provides base functionalities for Google Data API service +Net::Google::DataAPI::Role::Service - provides base functionalities for Google Data API service =head1 SYNOPSIS package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service' => { service => 'wise', diff --git a/lib/Net/Google/DataAPI/Types.pm b/lib/Net/Google/DataAPI/Types.pm index e1c938b..8aa63f1 100644 --- a/lib/Net/Google/DataAPI/Types.pm +++ b/lib/Net/Google/DataAPI/Types.pm @@ -1,6 +1,6 @@ package Net::Google::DataAPI::Types; -use Any::Moose; -use Any::Moose '::Util::TypeConstraints'; +use Moose; +use Moose::Util::TypeConstraints; use Net::Google::DataAPI::Auth::AuthSub; use Net::Google::AuthSub; use Net::OAuth2::AccessToken; @@ -38,7 +38,6 @@ coerce 'Net::Google::DataAPI::Types::OAuth2::AccessToken' __PACKAGE__->meta->make_immutable; -no Any::Moose; -no Any::Moose '::Util::TypeConstraints'; +no Moose; 1; diff --git a/t/01_role/01_service/01_instanciate.t b/t/01_role/01_service/01_instanciate.t index 93edc1c..309d286 100644 --- a/t/01_role/01_service/01_instanciate.t +++ b/t/01_role/01_service/01_instanciate.t @@ -15,7 +15,7 @@ BEGIN { { package MyService; - use Any::Moose; + use Moose; use Net::Google::AuthSub; use Net::Google::DataAPI::Auth::AuthSub; with 'Net::Google::DataAPI::Role::Service'; diff --git a/t/01_role/01_service/02_namespace.t b/t/01_role/01_service/02_namespace.t index b762cc7..672e362 100644 --- a/t/01_role/01_service/02_namespace.t +++ b/t/01_role/01_service/02_namespace.t @@ -11,7 +11,7 @@ BEGIN { { package MyService; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::Service'; has '+source' => (default => __PACKAGE__); has '+namespaces' => ( diff --git a/t/01_role/01_service/03_request.t b/t/01_role/01_service/03_request.t index eefd314..9801656 100644 --- a/t/01_role/01_service/03_request.t +++ b/t/01_role/01_service/03_request.t @@ -8,7 +8,7 @@ use HTTP::Response; { package MyService; - use Any::Moose; + use Moose; use Net::Google::AuthSub; use Net::Google::DataAPI::Auth::AuthSub; with 'Net::Google::DataAPI::Role::Service'; @@ -41,7 +41,7 @@ my $res = Test::MockObject->new; $res->mock(is_success => sub {1}); my $authsub = Test::MockModule->new('Net::Google::AuthSub'); $authsub->mock(login => sub {return $res}); -$authsub->mock(auth_params => sub {(Authorization => 'GoogleLogin ="MYAuth"')}); +$authsub->mock(auth_params => sub {(Authorization => 'GoogleLogin ="MYAuth"')}); my $ua = Test::MockModule->new('LWP::UserAgent'); my $ua_res = HTTP::Response->parse(<content, "OK\n"; } { - throws_ok { + throws_ok { $s->request( { uri => 'http://example.com/myentry', diff --git a/t/01_role/01_service/04_methods.t b/t/01_role/01_service/04_methods.t index f4fae3a..9bbcb25 100644 --- a/t/01_role/01_service/04_methods.t +++ b/t/01_role/01_service/04_methods.t @@ -6,12 +6,12 @@ use HTTP::Response; { package MyEntry; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::Entry'; } { package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; diff --git a/t/01_role/01_service/06_pass_through.t b/t/01_role/01_service/06_pass_through.t index d43f1bc..325e19d 100644 --- a/t/01_role/01_service/06_pass_through.t +++ b/t/01_role/01_service/06_pass_through.t @@ -14,7 +14,7 @@ BEGIN { { package MyService; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::Service'; } diff --git a/t/01_role/02_entry/01_instanciate.t b/t/01_role/02_entry/01_instanciate.t index 33fd0de..a8fdf77 100644 --- a/t/01_role/02_entry/01_instanciate.t +++ b/t/01_role/02_entry/01_instanciate.t @@ -8,7 +8,7 @@ BEGIN { { package MyService; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::Service' => { service => 'wise', source => __PACKAGE__, @@ -16,7 +16,7 @@ BEGIN { } { package MyEntry; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::Entry'; } diff --git a/t/01_role/02_entry/02_update.t b/t/01_role/02_entry/02_update.t index 6241d46..d28a118 100644 --- a/t/01_role/02_entry/02_update.t +++ b/t/01_role/02_entry/02_update.t @@ -7,7 +7,7 @@ use HTTP::Response; { package MyEntry; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; use XML::Atom::Util qw(textValue); @@ -37,7 +37,7 @@ use HTTP::Response; } { package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; @@ -65,7 +65,7 @@ my $e; gd:etag='"myetag"'> - hgoehgoe test entry @@ -102,7 +102,7 @@ END gd:etag='"myetag_updated"'> - foobar test entry @@ -129,7 +129,7 @@ END gd:etag='"myetag2"'> - test entry @@ -144,7 +144,7 @@ END gd:etag='"myetag_updated_again"'> - foobar test entry @@ -175,7 +175,7 @@ END gd:etag='"myetag2_updated"'> - hogehoge @@ -190,7 +190,7 @@ END gd:etag='"myetag_updated_once_more"'> - foobar test entry @@ -235,7 +235,7 @@ END gd:etag='"myetag_updated_once_more_again"'> - foobar test entry diff --git a/t/01_role/03_has_content/01_basic.t b/t/01_role/03_has_content/01_basic.t index 37fdccd..2d534c5 100644 --- a/t/01_role/03_has_content/01_basic.t +++ b/t/01_role/03_has_content/01_basic.t @@ -8,7 +8,7 @@ BEGIN { { package Foo; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::HasContent'; sub update { } diff --git a/t/02_feedurl/02_add.t b/t/02_feedurl/02_add.t index 4108010..a9a4702 100644 --- a/t/02_feedurl/02_add.t +++ b/t/02_feedurl/02_add.t @@ -52,7 +52,7 @@ Etag: "myetag" END } ); - + ok my $e = $s->add_myentry( { title => 'my title' diff --git a/t/02_feedurl/03_list.t b/t/02_feedurl/03_list.t index ca8e5f6..d850a97 100644 --- a/t/02_feedurl/03_list.t +++ b/t/02_feedurl/03_list.t @@ -50,7 +50,7 @@ Etag: "myetag" END } ); - + { ok my @e = $s->myentries({title => 'query title'}); ok scalar @e; @@ -169,7 +169,7 @@ Etag: "myetag" END } ); - + { ok my @e = $s->myentries; is scalar @e, 2; diff --git a/t/02_feedurl/04_delete.t b/t/02_feedurl/04_delete.t index 9424234..39bddc6 100644 --- a/t/02_feedurl/04_delete.t +++ b/t/02_feedurl/04_delete.t @@ -52,7 +52,7 @@ Etag: "myetag" END } ); - + ok $e = $s->add_myentry( { title => 'my title' diff --git a/t/02_feedurl/05_error.t b/t/02_feedurl/05_error.t index 817b0a8..f3026f0 100644 --- a/t/02_feedurl/05_error.t +++ b/t/02_feedurl/05_error.t @@ -7,7 +7,7 @@ use Test::MockModule; throws_ok { package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service' => { service => 'wise', @@ -22,12 +22,12 @@ throws_ok { { { package MyEntry; - use Any::Moose; + use Moose; with 'Net::Google::DataAPI::Role::Entry'; } { package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service' => { service => 'wise', @@ -45,7 +45,7 @@ throws_ok { ); throws_ok {$s->add_myentry} qr{myentry_feedurl is not set}; throws_ok {$s->myentry} qr{myentry_feedurl is not set}; -} +} #throws_ok { # { @@ -62,18 +62,18 @@ throws_ok { # { # { # package Bar; -# use Any::Moose; +# use Moose; # } # throws_ok { # { # package MyService; -# use Any::Moose; +# use Moose; # use Net::Google::DataAPI; # # with 'Net::Google::DataAPI::Role::Service' => { # # service => 'wise', # # source => __PACKAGE__ # # }; -# +# # feedurl 'foo' => ( # entry_class => 'Bar', # default => 'http://example.com/bar', diff --git a/t/03_entry_has/01_basic.t b/t/03_entry_has/01_basic.t index 6d9064e..f81a243 100644 --- a/t/03_entry_has/01_basic.t +++ b/t/03_entry_has/01_basic.t @@ -113,7 +113,7 @@ END { { package MyEntry; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; @@ -124,7 +124,7 @@ END } { package MyService; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; @@ -147,7 +147,7 @@ END { { package MyEntry2; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; @@ -160,7 +160,7 @@ END } { package MyService2; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; has '+namespaces' => ( @@ -192,7 +192,7 @@ END { { package MyEntry3; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; @@ -211,7 +211,7 @@ END } { package MyService3; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; has '+namespaces' => ( @@ -257,7 +257,7 @@ END { { package MyEntry4; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; @@ -270,7 +270,7 @@ END } { package MyService4; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; @@ -306,7 +306,7 @@ END { { package MyEntry5; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; @@ -320,7 +320,7 @@ END } { package MyService5; - use Any::Moose; + use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; diff --git a/t/03_entry_has/02_error.t b/t/03_entry_has/02_error.t index 9d8c513..12a5757 100644 --- a/t/03_entry_has/02_error.t +++ b/t/03_entry_has/02_error.t @@ -5,7 +5,7 @@ use Test::Exception; throws_ok { package MyaEntry; - use Any::Moose; + use Moose; use Net::Google::DataAPI; entry_has 'foobar' => ( diff --git a/t/04_auth/02_oauth.t b/t/04_auth/02_oauth.t index 85d97dc..f3e96d6 100644 --- a/t/04_auth/02_oauth.t +++ b/t/04_auth/02_oauth.t @@ -104,14 +104,14 @@ BEGIN { { $ua->mock('get' => sub { }); - throws_ok { - $oauth->get_request_token; + throws_ok { + $oauth->get_request_token; } qr{request failed: no response returned}; } { $ua->mock('get' => sub { HTTP::Response->new(400) }); - throws_ok { - $oauth->get_request_token; + throws_ok { + $oauth->get_request_token; } qr{request failed: 400 Bad Request}; } { @@ -185,14 +185,14 @@ BEGIN { { $ua->mock('get' => sub { }); - throws_ok { - $oauth->get_request_token; + throws_ok { + $oauth->get_request_token; } qr{request failed: no response returned}; } { $ua->mock('get' => sub { HTTP::Response->new(400) }); - throws_ok { - $oauth->get_request_token; + throws_ok { + $oauth->get_request_token; } qr{request failed: 400 Bad Request}; } { diff --git a/t/04_auth/04_oauth2.t b/t/04_auth/04_oauth2.t index e3329c7..986c10d 100644 --- a/t/04_auth/04_oauth2.t +++ b/t/04_auth/04_oauth2.t @@ -75,6 +75,7 @@ BEGIN { response_type => 'code', scope => 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email', state => '', + hd => '', } or note explain {$url->query_form}; ok my $access_token = $oauth2->get_access_token('mycode'); @@ -83,7 +84,7 @@ BEGIN { my $req = HTTP::Request->new('get' => 'http://foo.bar.com'); ok $oauth2->sign_request($req); is $req->header('Authorization'), 'Bearer my_access_token'; - + } { ok my $oauth2 = Net::Google::DataAPI::Auth::OAuth2->new( @@ -104,6 +105,7 @@ BEGIN { response_type => 'code', scope => 'http://spreadsheets.google.com/feeds/', state => 'hogehoge', + hd => '', } or note explain {$url->query_form}; # ok $oauth2->get_access_token('mycode'); @@ -129,6 +131,7 @@ BEGIN { access_type => 'offline', approval_prompt => 'force', state => 'foobar', + hd => '', } or note explain {$url->query_form}; # ok $oauth2->get_access_token('mycode'); diff --git a/t/05_types.t b/t/05_types.t index b345e7d..23d4253 100644 --- a/t/05_types.t +++ b/t/05_types.t @@ -3,7 +3,7 @@ use URI; { package My::Test; - use Any::Moose; + use Moose; use Net::Google::DataAPI::Types; has url => ( diff --git a/t/lib/MyService.pm b/t/lib/MyService.pm index 494c0e8..d1f4faf 100644 --- a/t/lib/MyService.pm +++ b/t/lib/MyService.pm @@ -1,10 +1,10 @@ package MyService; -use Any::Moose; +use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Service'; has '+namespaces' => ( - default => sub { + default => sub { +{ hoge => 'http://example.com/schemas#hoge', } @@ -24,7 +24,7 @@ feedurl fixed => ( __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; no Net::Google::DataAPI; 1; diff --git a/t/lib/MyService/MyEntry.pm b/t/lib/MyService/MyEntry.pm index dbcf93f..388c5cc 100644 --- a/t/lib/MyService/MyEntry.pm +++ b/t/lib/MyService/MyEntry.pm @@ -1,5 +1,5 @@ package MyService::MyEntry; -use Any::Moose; +use Moose; use Net::Google::DataAPI; with 'Net::Google::DataAPI::Role::Entry'; use XML::Atom::Util qw(textValue); @@ -47,7 +47,7 @@ entry_has foobar => ( __PACKAGE__->meta->make_immutable; -no Any::Moose; +no Moose; no Net::Google::DataAPI; 1; diff --git a/xt/perlcriticrc b/xt/perlcriticrc index 0910b96..1ad0403 100644 --- a/xt/perlcriticrc +++ b/xt/perlcriticrc @@ -1,5 +1,5 @@ [TestingAndDebugging::ProhibitNoStrict] -allow=refs +allow = refs [TestingAndDebugging::RequireUseStrict] -equivalent_modules = Any::Moose +equivalent_modules = Moose From 7db91230c01572733cb8e89f4f36648f497c59ba Mon Sep 17 00:00:00 2001 From: Amiri Barksdale at Home Date: Thu, 25 Oct 2018 17:40:14 -0700 Subject: [PATCH 2/2] Forgot to change Makefile.PL to use Moose --- Makefile.PL | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index f8a54a5..b8836ab 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -14,11 +14,7 @@ requires 'LWP::Protocol::https'; requires 'URI'; requires 'Lingua::EN::Inflect::Number'; requires 'Text::Glob'; -requires_any_moose( - prefer => 'Mouse', - moose => '0.56', - mouse => '0.51', -); +requires 'Moose'; tests_recursive; author_tests 'xt';