Commits

Toby Inkster committed e8551ab

port from Any::Moose to Moo

Comments (0)

Files changed (20)

 
 BEGIN {
 	$P5U::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::VERSION   = '0.004';
+	$P5U::VERSION   = '0.005';
 };
 
 __PACKAGE__

lib/P5U/Command/About.pm

 
 BEGIN {
 	$P5U::Command::About::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::About::VERSION   = '0.004';
+	$P5U::Command::About::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/Aliases.pm

 
 BEGIN {
 	$P5U::Command::Aliases::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Aliases::VERSION   = '0.004';
+	$P5U::Command::Aliases::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/AutoProve.pm

 
 BEGIN {
 	$P5U::Command::AutoProve::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::AutoProve::VERSION   = '0.004';
+	$P5U::Command::AutoProve::VERSION   = '0.005';
 };
 
 use Cwd 'cwd';

lib/P5U/Command/Commands.pm

 
 BEGIN {
 	$P5U::Command::Commands::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Commands::VERSION   = '0.004';
+	$P5U::Command::Commands::VERSION   = '0.005';
 };
 
 use 5.010;
 
 BEGIN {
 	$P5U::Command::Commands::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Commands::VERSION   = '0.004';
+	$P5U::Command::Commands::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/DebianRelease.pm

 
 BEGIN {
 	$P5U::Command::DebianRelease::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::DebianRelease::VERSION   = '0.004';
+	$P5U::Command::DebianRelease::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/Reprove.pm

 
 BEGIN {
 	$P5U::Command::Reprove::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Reprove::VERSION   = '0.004';
+	$P5U::Command::Reprove::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/TestPod.pm

 
 BEGIN {
 	$P5U::Command::TestPod::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::TestPod::VERSION   = '0.004';
+	$P5U::Command::TestPod::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/Testers.pm

 
 BEGIN {
 	$P5U::Command::Testers::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Testers::VERSION   = '0.004';
+	$P5U::Command::Testers::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/Version.pm

 
 BEGIN {
 	$P5U::Command::Version::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Version::VERSION   = '0.004';
+	$P5U::Command::Version::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Command/Whois.pm

 
 BEGIN {
 	$P5U::Command::Whois::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::Whois::VERSION   = '0.004';
+	$P5U::Command::Whois::VERSION   = '0.005';
 };
 
 use constant {

lib/P5U/Lib/AutoProve.pm

 
 BEGIN {
 	$P5U::Lib::AutoProve::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Lib::AutoProve::VERSION   = '0.004';
+	$P5U::Lib::AutoProve::VERSION   = '0.005';
 };
 
 use 5.010;

lib/P5U/Lib/DebianRelease.pm

 
 BEGIN {
 	$P5U::Lib::DebianRelease::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Lib::DebianRelease::VERSION   = '0.004';
+	$P5U::Lib::DebianRelease::VERSION   = '0.005';
 };
 
-use Any::Moose       0;
+use Moo;
+use Scalar::Does;
 use IO::Uncompress::Gunzip qw< gunzip $GunzipError >;
 use JSON             2.00  qw< from_json >;
 use LWP::Simple      0     qw< get >;
 use namespace::clean;
 
 has debian => (
-	is         => 'ro',
-	isa        => 'HashRef',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does('HASH'),
 );
 
 has cache_file => (
 
 This is a support library for the debian-release command.
 
-It's an L<Any::Moose>-based class.
+It's a L<Moo>-based class.
 
 =head2 Constructor
 

lib/P5U/Lib/Reprove.pm

 
 BEGIN {
 	$P5U::Lib::Reprove::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Lib::Reprove::VERSION   = '0.004';
+	$P5U::Lib::Reprove::VERSION   = '0.005';
 };
 
 use 5.010;
 use autodie;
 
-use Any::Moose;
+use Moo;
+use Scalar::Does;
 use App::Prove qw//;
 use Class::Load qw/load_class/;
+use Carp qw/confess/;
 use JSON qw/from_json/;
 use File::pushd qw/pushd/;
 use File::Temp qw//;
 use Object::AUTHORITY qw/AUTHORITY/;
 
 has author => (
-	is         => 'ro',
-	isa        => 'Str',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[""]),
 );
 
 has release => (
 	is         => 'ro',
-	isa        => 'Str',
+	isa        => does(q[""]),
 	required   => 1,
 );
 
 has version => (
 	is         => 'ro',
-	isa        => 'Str',
+	isa        => does(q[""]),
 	required   => 1,
 );
 
 has manifest => (
-	is         => 'ro',
-	isa        => 'ArrayRef[Str]',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[ARRAY]),
 );
 
 has testdir => (
-	is         => 'ro',
-	isa        => 'Path::Class::Dir',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[Path::Class::Dir]),
 );
 
 has working_dir => (
-	is         => 'ro',
-	isa        => 'Path::Class::Dir',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[Path::Class::Dir]),
 );
 
 has verbose => (
 	is         => 'rw',
-	isa        => 'Bool',
+	isa        => does(q[bool]),
 	required   => 1,
-	default    => 0,
+	default    => sub { 0 },
 );
 
 sub BUILDARGS
 
 =item C<< new(%attributes) >>
 
-Construct an object with given attributes. This is a Moose-based class.
+Construct an object with given attributes. This is a Moo-based class.
 
 =back
 

lib/P5U/Lib/TestPod.pm

 
 BEGIN {
 	$P5U::Command::TestPod::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Command::TestPod::VERSION   = '0.004';
+	$P5U::Command::TestPod::VERSION   = '0.005';
 };
 
 use Object::AUTHORITY;

lib/P5U/Lib/Testers.pm

 
 BEGIN {
 	$P5U::Lib::Testers::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Lib::Testers::VERSION   = '0.004';
+	$P5U::Lib::Testers::VERSION   = '0.005';
 };
 
-use Any::Moose       0;
+use Moo;
+use Scalar::Does;
 use File::Spec       0 qw< >;
 use JSON             0 qw< from_json >;
 use LWP::Simple      0 qw< mirror is_success >;
 
 has distro => (
 	is         => 'ro',
-	isa        => 'Str',
+	isa        => does(q[""]),
 	required   => 1,
 );
 
 has version => (
-	is         => 'ro',
-	isa        => 'Str',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[""]),
 );
 
 has os_data => (
-	is       => 'ro',
-	isa      => 'Bool',
-	default  => 0,
+	is         => 'ro',
+	isa        => does(q[bool]),
+	default    => sub { 0 },
 );
 
 has stable => (
-	is       => 'ro',
-	isa      => 'Bool',
-	default  => 0,
+	is         => 'ro',
+	isa        => does(q[bool]),
+	default    => sub { 0 },
 );
 
 has cache_dir => (
-	is         => 'ro',
-	isa        => 'Str',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[bool]),
 );
 
 has results => (
-	is         => 'ro',
-	isa        => 'ArrayRef',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[ARRAY]),
 );
 
 sub version_data
 
 This is a support library for the testers command.
 
-It's an L<Any::Moose>-based class.
+It's a L<Moo>-based class.
 
 =head2 Constructor
 

lib/P5U/Lib/Version.pm

 
 BEGIN {
 	$P5U::Lib::Version::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Lib::Version::VERSION   = '0.004';
+	$P5U::Lib::Version::VERSION   = '0.005';
 };
 
 use JSON qw< from_json >;

lib/P5U/Lib/Whois.pm

 
 BEGIN {
 	$P5U::Lib::Whois::AUTHORITY = 'cpan:TOBYINK';
-	$P5U::Lib::Whois::VERSION   = '0.004';
+	$P5U::Lib::Whois::VERSION   = '0.005';
 };
 
-use Any::Moose; no warnings;
+use Moo; no warnings;
+use Scalar::Does;
 use JSON qw(from_json);
 use LWP::Simple qw(get);
 use Object::AUTHORITY;
 
 has cpanid => (
 	is         => 'ro',
-	isa        => 'Str',
+	isa        => does(q[""]),
 );
 
 has metacpan_data => (
-	is         => 'ro',
-	isa        => 'HashRef',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[HASH]),
 );
 
 sub _build_metacpan_data
 }
 
 has metacpan_releases => (
-	is         => 'ro',
-	isa        => 'ArrayRef',
-	lazy_build => 1,
+	is         => 'lazy',
+	isa        => does(q[ARRAY]),
 );
 
 sub _build_metacpan_releases
 	]
 }
 
-has [qw(name city region country)] => (
-	is         => 'ro',
-	isa        => 'Str|Undef',
-	lazy_build => 1,
-);
+has $_ => (
+	is         => 'lazy',
+	isa        => sub { !defined $_[0] or does($_[0], q[""]) },
+) for qw(name city region country);
 
 sub _build_name     { $_[0]->metacpan_data->{name} }
 sub _build_city     { $_[0]->metacpan_data->{city} }
 sub _build_region   { $_[0]->metacpan_data->{region} }
 sub _build_country  { $_[0]->metacpan_data->{country} }
 
-has [qw(latitude longitude)] => (
-	is         => 'ro',
-	isa        => 'Num|Undef',
-	lazy_build => 1,
-);
+has $_ => (
+	is         => 'lazy',
+	isa        => sub { !defined $_[0] or does($_[0], q[0+]) },
+) for qw(latitude longitude);
 
 sub _build_longitude { $_[0]->metacpan_data->{location}[0] }
 sub _build_latitude  { $_[0]->metacpan_data->{location}[1] }
 
-has [qw(website email)] => (
-	is         => 'ro',
-	isa        => 'ArrayRef[Str]',
-	lazy_build => 1,
-);
+has $_ => (
+	is         => 'lazy',
+	isa        => does(q[ARRAY]),
+) for qw(website email);
 
 sub _build_website
 {
 		$report .= join "\n", q(), q(Recent:), @recent[0..9], q()
 			if @recent;
 		
-		if (@{ $self->metacpan_data->{profile} })
+		if (@{ $self->metacpan_data->{profile} || [] })
 		{
 			$report .= "\n";
 			for (sort { $a->{name} cmp $b->{name} } @{ $self->metacpan_data->{profile} })
 
 This is a support library for the testers command.
 
-It's an L<Any::Moose>-based class.
+It's a L<Moo>-based class.
 
 =head2 Constructor
 

lib/P5U/Tutorial/Development.pod

 (because App::Cmd or P5U has already loaded them) are L<Class::Load>,
 L<JSON>, L<Path::Class>.
 
-If you need OO, then use L<Any::Moose> (but do it in a workhorse module
-that's loaded on demand) and L<namespace::clean>. If you need the web,
-then use L<LWP::UserAgent> or L<LWP::Simple>. If you need to do stuff
-with the file system, use L<Path::Class> and L<Path::Class::Rule>. These
-are good modules, and they're already listed as P5U dependencies, so
-there's no reason to avoid them.
+If you need OO, then use L<Moo> (but do it in a workhorse module that's
+loaded on demand) and L<namespace::clean>. If you need the web, then use
+L<LWP::UserAgent> or L<LWP::Simple>. If you need to do stuff with the
+file system, use L<Path::Class> and L<Path::Class::Rule>. These are good
+modules, and they're already listed as P5U dependencies, so there's no
+reason to avoid them.
 
 =head2 TEMPLATE
 

meta/makefile.ttl

 	:version_from       _:main;
 	:readme_from        _:main;
 	:install_script     _:script;
-	:requires           "Any::Moose";
 	:requires           "App::Cmd";
 	:requires           "autodie";
 	:requires           "Class::Load";
 	:requires           "LWP::Simple";
 	:requires           "Module::Info";
 	:requires           "Module::Manifest";
+	:requires           "Moo 1.000000";
 	:requires           "namespace::clean 0.19";
 	:requires           "Object::AUTHORITY";
 	:requires           "Path::Class";
 	:requires           "Path::Class::Rule";
 	:requires           "PerlX::Maybe";
+	:requires           "Scalar::Does 0.004";
 	:requires           "Test::Pod";
 	:test_requires      "Test::More 0.61".