--- /dev/null
+use strict;
+use warnings;
+
+use Module::Build;
+
+my $builder = Module::Build->new
+ ( module_name => 'MooseX::Policy::SemiAffordanceAccessor',
+ license => 'perl',
+ requires => { 'Moose' => 0,
+ 'Moose::Policy' => '0.03',
+ },
+ build_requires => { 'Test::More' => 0,
+ },
+ create_makefile_pl => 'passthrough',
+ create_readme => 1,
+ sign => 1,
+ );
+
+$builder->create_build_script();
--- /dev/null
+0.01 Date/time
+
+* First version, released on an unsuspecting world.
--- /dev/null
+Build.PL
+Changes
+MANIFEST
+MANIFEST.SKIP
+META.yml # Will be created by "make dist"
+README # Will be created by "make dist"
+lib/MooseX/Policy/SemiAffordanceAccessor.pm
+t/perlcritic.t
+t/pod-coverage.t
+t/pod.t
--- /dev/null
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+,v$
+\B\.svn\b
+
+# Avoid Makemaker generated and utility files.
+\bMakefile$
+\bblib
+\bMakeMaker-\d
+\bpm_to_blib$
+\bblibdirs$
+^MANIFEST\.SKIP$
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build
+
+# Avoid temp and backup files.
+~$
+\.old$
+\.bak$
+\#$
+\b\.#
+
+# Avoid tarballs
+\.(?:tar|tgz|tar\.gz)$
--- /dev/null
+package MooseX::Policy::SemiAffordanceAccessor;
+
+use strict;
+use warnings;
+
+our $VERSION = '0.01';
+our $AUTHORITY = 'cpan:DROLSKY';
+
+use constant attribute_metaclass => 'MooseX::Policy::SemiAffordanceAccessor::Attribute';
+
+
+package MooseX::Policy::SemiAffordanceAccessor::Attribute;
+
+use Moose;
+
+extends 'Moose::Meta::Attribute';
+
+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' )
+ {
+ $options->{reader} = $name;
+ }
+ elsif ( $options->{is} eq 'rw' )
+ {
+ $options->{reader} = $name;
+
+ my $prefix = 'set';
+ if ( $name =~ s/^_// )
+ {
+ $prefix = '_set';
+ }
+
+ $options->{writer} = $prefix . q{_} . $name;
+ }
+
+ delete $options->{is};
+ }
+};
+
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::Policy::SemiAffordanceAccessor - A policy to name accessors foo() and set_foo()
+
+=head1 SYNOPSIS
+
+ use Moose::Policy 'MooseX::Policy::SemiAffordanceAccessor';
+ use Moose;
+
+ # make some attributes
+
+=head1 DESCRIPTION
+
+This class does not provide any methods. Just loading it changes the
+default naming policy for the package so that accessors are separated
+into get and set methods. The get methods have the same name as the
+accessor, while set methods are prefixed with "set_".
+
+If you define an attribute with a leading underscore, then the set
+method will start with "_set_".
+
+The name "semi-affordance" comes from David Wheeler's Class::Meta
+module.
+
+=head1 AUTHOR
+
+Dave Rolsky, C<< <autarch@urth.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-moosex-policy-semiaffordanceaccessor@rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org>. I will be notified, and
+then you'll automatically be notified of progress on your bug as I
+make changes.
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007 Dave Rolsky, All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+
+{
+ package Standard;
+
+ use Moose;
+
+ has 'thing' => ( is => 'rw' );
+ has '_private' => ( is => 'rw' );
+}
+
+{
+ package SF;
+
+ use Moose::Policy 'MooseX::Policy::SemiAffordanceAccessor';
+ use Moose;
+
+ has 'thing' => ( is => 'rw' );
+ has '_private' => ( is => 'rw' );
+}
+
+
+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( SF->can('thing'), 'SF->thing() exists' );
+ok( SF->can('set_thing'), 'SF->set_thing() exists' );
+ok( SF->can('_private'), 'SF->_private() exists' );
+ok( SF->can('_set_private'), 'SF->_set_private() exists' );
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+
+
+plan skip_all => 'This test is only run for the module author'
+ unless -d '.svn' || $ENV{IS_MAINTAINER};
+
+eval 'use Test::Perl::Critic ( -severity => 4 )';
+plan skip_all => 'Test::Perl::Critic required for testing POD' if $@;
+
+all_critic_ok();
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+
+
+plan skip_all => 'This test is only run for the module author'
+ unless -d '.svn' || $ENV{IS_MAINTAINER};
+
+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();
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+
+
+plan skip_all => 'This test is only run for the module author'
+ unless -d '.svn' || $ENV{IS_MAINTAINER};
+
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+
+all_pod_files_ok();