From: Dave Rolsky Date: Wed, 5 May 2010 15:59:19 +0000 (-0500) Subject: run all code through perltidy X-Git-Tag: v0.06~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f227d76fb09916e436174dbdb1b5e4eb8f57d465;p=gitmo%2FMooseX-SemiAffordanceAccessor.git run all code through perltidy --- diff --git a/Build.PL b/Build.PL index ec80cc1..4ac4290 100644 --- a/Build.PL +++ b/Build.PL @@ -5,16 +5,18 @@ require 5.00601; use Module::Build; -my $builder = Module::Build->new - ( module_name => 'MooseX::SemiAffordanceAccessor', - license => 'perl', - requires => { 'Moose' => '0.84', - }, - build_requires => { 'Test::More' => '0', - }, - create_makefile_pl => 'passthrough', - create_readme => 1, - sign => 1, - ); +my $builder = Module::Build->new( + module_name => 'MooseX::SemiAffordanceAccessor', + license => 'perl', + requires => { + 'Moose' => '0.84', + }, + build_requires => { + 'Test::More' => '0', + }, + create_makefile_pl => 'passthrough', + create_readme => 1, + sign => 1, +); $builder->create_build_script(); diff --git a/lib/MooseX/SemiAffordanceAccessor.pm b/lib/MooseX/SemiAffordanceAccessor.pm index 57afd2f..8825503 100644 --- a/lib/MooseX/SemiAffordanceAccessor.pm +++ b/lib/MooseX/SemiAffordanceAccessor.pm @@ -14,19 +14,17 @@ use MooseX::SemiAffordanceAccessor::Role::Attribute; # in $p{for_class} later. Moose::Exporter->setup_import_methods(); -sub init_meta -{ +sub init_meta { shift; my %p = @_; Moose->init_meta(%p); - return - Moose::Util::MetaRole::apply_metaclass_roles - ( for_class => $p{for_class}, - attribute_metaclass_roles => - ['MooseX::SemiAffordanceAccessor::Role::Attribute'], - ); + return Moose::Util::MetaRole::apply_metaclass_roles( + for_class => $p{for_class}, + attribute_metaclass_roles => + ['MooseX::SemiAffordanceAccessor::Role::Attribute'], + ); } 1; diff --git a/lib/MooseX/SemiAffordanceAccessor/Role/Attribute.pm b/lib/MooseX/SemiAffordanceAccessor/Role/Attribute.pm index 5ae19f5..303b7a2 100644 --- a/lib/MooseX/SemiAffordanceAccessor/Role/Attribute.pm +++ b/lib/MooseX/SemiAffordanceAccessor/Role/Attribute.pm @@ -5,28 +5,22 @@ use warnings; use Moose::Role; - -before '_process_options' => sub -{ +before '_process_options' => sub { my $class = shift; my $name = shift; my $options = shift; - if ( exists $options->{is} && - ! ( exists $options->{reader} || exists $options->{writer} ) ) - { - if ( $options->{is} eq 'ro' ) - { + if ( exists $options->{is} + && !( exists $options->{reader} || exists $options->{writer} ) ) { + if ( $options->{is} eq 'ro' ) { $options->{reader} = $name; delete $options->{is}; } - elsif ( $options->{is} eq 'rw' ) - { + elsif ( $options->{is} eq 'rw' ) { $options->{reader} = $name; my $prefix = 'set'; - if ( $name =~ s/^_// ) - { + if ( $name =~ s/^_// ) { $prefix = '_set'; } diff --git a/t/basic.t b/t/basic.t index 3b6532b..123e3e6 100644 --- a/t/basic.t +++ b/t/basic.t @@ -3,49 +3,53 @@ use warnings; use Test::More tests => 21; - { + package Standard; use Moose; - has 'thing' => ( is => 'rw' ); + has 'thing' => ( is => 'rw' ); has '_private' => ( is => 'rw' ); } { + package SAA; use MooseX::SemiAffordanceAccessor; use Moose; - has 'thing' => ( is => 'rw' ); + has 'thing' => ( is => 'rw' ); has '_private' => ( is => 'rw' ); } { + package SAA2; # Make sure load order doesn't matter use Moose; use MooseX::SemiAffordanceAccessor; - has 'thing' => ( is => 'rw' ); + has 'thing' => ( is => 'rw' ); has '_private' => ( is => 'rw' ); } { + package SAA3; use Moose; use MooseX::SemiAffordanceAccessor; - has 'ro' => ( is => 'ro' ); - has 'thing' => ( is => 'rw', reader => 'get_thing' ); + has 'ro' => ( is => 'ro' ); + has 'thing' => ( is => 'rw', reader => 'get_thing' ); has 'thing2' => ( is => 'rw', writer => 'set_it' ); } { + package SAA4; use Moose; @@ -54,29 +58,29 @@ use Test::More tests => 21; has bare => ( is => 'bare' ); } +ok( Standard->can('thing'), 'Standard->thing() exists' ); +ok( !Standard->can('set_thing'), 'Standard->set_thing() does not exist' ); +ok( Standard->can('_private'), 'Standard->_private() exists' ); +ok( !Standard->can('_set_private'), + 'Standard->_set_private() does not exist' ); -ok( Standard->can('thing'), 'Standard->thing() exists' ); -ok( ! Standard->can('set_thing'), 'Standard->set_thing() does not exist' ); -ok( Standard->can('_private'), 'Standard->_private() exists' ); -ok( ! Standard->can('_set_private'), 'Standard->_set_private() does not exist' ); - -ok( SAA->can('thing'), 'SAA->thing() exists' ); -ok( SAA->can('set_thing'), 'SAA->set_thing() exists' ); -ok( SAA->can('_private'), 'SAA->_private() exists' ); +ok( SAA->can('thing'), 'SAA->thing() exists' ); +ok( SAA->can('set_thing'), 'SAA->set_thing() exists' ); +ok( SAA->can('_private'), 'SAA->_private() exists' ); ok( SAA->can('_set_private'), 'SAA->_set_private() exists' ); -ok( SAA2->can('thing'), 'SAA2->thing() exists' ); -ok( SAA2->can('set_thing'), 'SAA2->set_thing() exists' ); -ok( SAA2->can('_private'), 'SAA2->_private() exists' ); +ok( SAA2->can('thing'), 'SAA2->thing() exists' ); +ok( SAA2->can('set_thing'), 'SAA2->set_thing() exists' ); +ok( SAA2->can('_private'), 'SAA2->_private() exists' ); ok( SAA2->can('_set_private'), 'SAA2->_set_private() exists' ); -ok( SAA3->can('ro'), 'SAA3->ro exists' ); -ok( ! SAA3->can('set_ro'), 'SAA3->set_ro does not exist' ); -ok( SAA3->can('thing'), 'SAA3->thing exists' ); -ok( ! SAA3->can('set_thing'), 'SAA3->set_thing does not exist' ); -ok( SAA3->can('thing2'), 'SAA3->thing2 exists' ); -ok( ! SAA3->can('set_thing2'), 'SAA3->set_thing2 does not exist' ); -ok( SAA3->can('set_it'), 'SAA3->set_it does exist' ); +ok( SAA3->can('ro'), 'SAA3->ro exists' ); +ok( !SAA3->can('set_ro'), 'SAA3->set_ro does not exist' ); +ok( SAA3->can('thing'), 'SAA3->thing exists' ); +ok( !SAA3->can('set_thing'), 'SAA3->set_thing does not exist' ); +ok( SAA3->can('thing2'), 'SAA3->thing2 exists' ); +ok( !SAA3->can('set_thing2'), 'SAA3->set_thing2 does not exist' ); +ok( SAA3->can('set_it'), 'SAA3->set_it does exist' ); -ok( ! SAA4->can('bare'), 'SAA4->bare does not exist' ); -ok( ! SAA4->can('set_bare'), 'SAA4->set_bare does not exist' ); +ok( !SAA4->can('bare'), 'SAA4->bare does not exist' ); +ok( !SAA4->can('set_bare'), 'SAA4->set_bare does not exist' ); diff --git a/t/pod-coverage.t b/t/pod-coverage.t index 5e0e20b..75a07a1 100644 --- a/t/pod-coverage.t +++ b/t/pod-coverage.t @@ -3,7 +3,6 @@ use warnings; use Test::More; - plan skip_all => 'This test is only run for the module author' unless -d '.git' || $ENV{IS_MAINTAINER}; @@ -11,4 +10,4 @@ eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; -all_pod_coverage_ok( { trustme => [ qr/^init_meta$/ ] } ); +all_pod_coverage_ok( { trustme => [qr/^init_meta$/] } ); diff --git a/t/pod.t b/t/pod.t index 8c9830b..9e30f41 100644 --- a/t/pod.t +++ b/t/pod.t @@ -3,7 +3,6 @@ use warnings; use Test::More; - plan skip_all => 'This test is only run for the module author' unless -d '.git' || $ENV{IS_MAINTAINER};