From cb170931288a0dbef03fece2a0fa01decbd5dfbb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 18 Jul 2010 23:58:56 -0500 Subject: update dzil stuff --- .gitignore | 13 +++++++++ Changes | 26 +++++++++--------- dist.ini | 9 ++++--- lib/MooseX/ABC.pm | 61 +++++-------------------------------------- lib/MooseX/ABC/Role/Object.pm | 46 +------------------------------- lib/MooseX/ABC/Trait/Class.pm | 46 +------------------------------- t/000-load.t | 9 ------- t/001-basic.t | 40 ---------------------------- t/002-immutable.t | 46 -------------------------------- t/003-custom-constructor.t | 24 ----------------- t/004-abstract-subclass.t | 35 ------------------------- t/01-basic.t | 40 ++++++++++++++++++++++++++++ t/02-immutable.t | 46 ++++++++++++++++++++++++++++++++ t/03-custom-constructor.t | 24 +++++++++++++++++ t/04-abstract-subclass.t | 35 +++++++++++++++++++++++++ weaver.ini | 36 +++++++++++++++++++++++++ 16 files changed, 221 insertions(+), 315 deletions(-) create mode 100644 .gitignore delete mode 100644 t/000-load.t delete mode 100644 t/001-basic.t delete mode 100644 t/002-immutable.t delete mode 100644 t/003-custom-constructor.t delete mode 100644 t/004-abstract-subclass.t create mode 100644 t/01-basic.t create mode 100644 t/02-immutable.t create mode 100644 t/03-custom-constructor.t create mode 100644 t/04-abstract-subclass.t create mode 100644 weaver.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5030425 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +cover_db +META.yml +Makefile +blib +inc +pm_to_blib +MANIFEST +Makefile.old +nytprof.out +MANIFEST.bak +*.sw[po] +.build +MooseX-ABC-* diff --git a/Changes b/Changes index 732e6ae..8de0db1 100644 --- a/Changes +++ b/Changes @@ -1,18 +1,18 @@ -Revision history for MooseX::ABC +Revision history for MooseX-ABC -0.05 7/18/2010 - Fix deprecation warning in newer Moose +{{$NEXT}} + - Fix deprecation warning in newer Moose. -0.04 12/20/2009 - No actual changes, just repackaging with a new Dist::Zilla that doesn't - mess up POD stuff +0.04 2009-12-20 + - No actual changes, just repackaging with a new Dist::Zilla that doesn't + mess up POD stuff. -0.03 12/20/2009 - Allow creation of abstract subclasses of abstract classes +0.03 2009-12-20 + - Allow creation of abstract subclasses of abstract classes. -0.02 7/10/2009 - Fix a warning on make_immutable when extending a class extended from an - abstract class +0.02 2009-07-10 + - Fix a warning on make_immutable when extending a class extended from an + abstract class. -0.01 7/03/2009 - Initial release +0.01 2009-07-03 + - Initial release. diff --git a/dist.ini b/dist.ini index a45b3c7..a20475c 100644 --- a/dist.ini +++ b/dist.ini @@ -1,12 +1,13 @@ name = MooseX-ABC -version = 0.04 author = Jesse Luehrs license = Perl_5 copyright_holder = Jesse Luehrs -abstract = abstract base classes for Moose -[@Classic] +[@DOY] +dist = MooseX-ABC [Prereq] -Moose = 0.90 +Moose = 0.94 + +[Prereq / TestRequires] Test::Exception = 0 diff --git a/lib/MooseX/ABC.pm b/lib/MooseX/ABC.pm index ee31435..452446a 100644 --- a/lib/MooseX/ABC.pm +++ b/lib/MooseX/ABC.pm @@ -1,10 +1,7 @@ package MooseX::ABC; use Moose (); use Moose::Exporter; - -=head1 NAME - -MooseX::ABC - abstract base classes for Moose +# ABSTRACT: abstract base classes for Moose =head1 SYNOPSIS @@ -44,11 +41,7 @@ their ancestors' required methods. =cut -=head1 EXPORTS - -=cut - -=head2 requires METHOD_NAMES +=func requires METHOD_NAMES Takes a list of methods that classes inheriting from this one must implement. If a class inherits from this class without implementing each method listed @@ -78,56 +71,16 @@ sub init_meta { return $ret; } -=head1 BUGS - -No known bugs. - -Please report any bugs through RT: email -C, or browse to -L. - =head1 SEE ALSO -L, L - -=head1 SUPPORT - -You can find this documentation for this module with the perldoc command. - - perldoc MooseX::ABC - -You can also look for information at: - -=over 4 - -=item * AnnoCPAN: Annotated CPAN documentation - -L - -=item * CPAN Ratings - -L - -=item * RT: CPAN's request tracker - -L - -=item * Search CPAN - -L - -=back - -=head1 AUTHOR - - Jesse Luehrs +L +L -=head1 COPYRIGHT AND LICENSE +=begin Pod::Coverage -This software is copyright (c) 2009 by Jesse Luehrs. + init_meta -This is free software; you can redistribute it and/or modify it under -the same terms as perl itself. +=end Pod::Coverage =cut diff --git a/lib/MooseX/ABC/Role/Object.pm b/lib/MooseX/ABC/Role/Object.pm index 765ef64..fd56386 100644 --- a/lib/MooseX/ABC/Role/Object.pm +++ b/lib/MooseX/ABC/Role/Object.pm @@ -1,9 +1,6 @@ package MooseX::ABC::Role::Object; use Moose::Role; - -=head1 NAME - -MooseX::ABC::Role::Object - base object role for L +# ABSTRACT: base object role for L =head1 DESCRIPTION @@ -23,45 +20,4 @@ around new => sub { no Moose::Role; -=head1 SUPPORT - -You can find this documentation for this module with the perldoc command. - - perldoc MooseX::ABC - -You can also look for information at: - -=over 4 - -=item * AnnoCPAN: Annotated CPAN documentation - -L - -=item * CPAN Ratings - -L - -=item * RT: CPAN's request tracker - -L - -=item * Search CPAN - -L - -=back - -=head1 AUTHOR - - Jesse Luehrs - -=head1 COPYRIGHT AND LICENSE - -This software is copyright (c) 2009 by Jesse Luehrs. - -This is free software; you can redistribute it and/or modify it under -the same terms as perl itself. - -=cut - 1; diff --git a/lib/MooseX/ABC/Trait/Class.pm b/lib/MooseX/ABC/Trait/Class.pm index e54e70b..1b221b0 100644 --- a/lib/MooseX/ABC/Trait/Class.pm +++ b/lib/MooseX/ABC/Trait/Class.pm @@ -1,9 +1,6 @@ package MooseX::ABC::Trait::Class; use Moose::Role; - -=head1 NAME - -MooseX::ABC::Trait::Class - metaclass trait for L +# ABSTRACT: metaclass trait for L =head1 DESCRIPTION @@ -75,45 +72,4 @@ around _immutable_options => sub { no Moose::Role; -=head1 SUPPORT - -You can find this documentation for this module with the perldoc command. - - perldoc MooseX::ABC - -You can also look for information at: - -=over 4 - -=item * AnnoCPAN: Annotated CPAN documentation - -L - -=item * CPAN Ratings - -L - -=item * RT: CPAN's request tracker - -L - -=item * Search CPAN - -L - -=back - -=head1 AUTHOR - - Jesse Luehrs - -=head1 COPYRIGHT AND LICENSE - -This software is copyright (c) 2009 by Jesse Luehrs. - -This is free software; you can redistribute it and/or modify it under -the same terms as perl itself. - -=cut - 1; diff --git a/t/000-load.t b/t/000-load.t deleted file mode 100644 index 2854494..0000000 --- a/t/000-load.t +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 1; - -package Foo; -use Moose; -::use_ok('MooseX::ABC') - or ::BAIL_OUT("couldn't load MooseX::ABC"); diff --git a/t/001-basic.t b/t/001-basic.t deleted file mode 100644 index d5951d4..0000000 --- a/t/001-basic.t +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 9; -use Test::Exception; - -package Foo; -use Moose; -use MooseX::ABC; - -requires 'bar', 'baz'; - -package Foo::Sub1; -use Moose; -::lives_ok { extends 'Foo' } 'extending works when the requires are fulfilled'; -sub bar { } -sub baz { } - -package Foo::Sub2; -use Moose; -::throws_ok { extends 'Foo' } qr/Foo requires Foo::Sub2 to implement baz/, - 'extending fails with the correct error when requires are not fulfilled'; -sub bar { } - -package Foo::Sub::Sub; -use Moose; -::lives_ok { extends 'Foo::Sub1' } 'extending twice works'; - -package main; -my $foosub; -lives_ok { $foosub = Foo::Sub1->new } - 'instantiating concrete subclasses works'; -isa_ok($foosub, 'Foo', 'inheritance is correct'); -my $foosubsub; -lives_ok { $foosubsub = Foo::Sub::Sub->new } - 'instantiating deeper concrete subclasses works'; -isa_ok($foosubsub, 'Foo', 'inheritance is correct'); -isa_ok($foosubsub, 'Foo::Sub1', 'inheritance is correct'); -throws_ok { Foo->new } qr/Foo is abstract, it cannot be instantiated/, - 'instantiating abstract classes fails'; diff --git a/t/002-immutable.t b/t/002-immutable.t deleted file mode 100644 index 66424da..0000000 --- a/t/002-immutable.t +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 9; -use Test::Exception; - -package Foo; -use Moose; -use MooseX::ABC; - -requires 'bar', 'baz'; - -__PACKAGE__->meta->make_immutable; - -package Foo::Sub1; -use Moose; -::lives_ok { extends 'Foo' } 'extending works when the requires are fulfilled'; -sub bar { } -sub baz { } - -__PACKAGE__->meta->make_immutable; - -package Foo::Sub2; -use Moose; -::throws_ok { extends 'Foo' } qr/Foo requires Foo::Sub2 to implement baz/, - 'extending fails with the correct error when requires are not fulfilled'; -sub bar { } - -package Foo::Sub::Sub; -use Moose; -::lives_ok { extends 'Foo::Sub1' } 'extending twice works'; - -__PACKAGE__->meta->make_immutable; - -package main; -my $foosub; -lives_ok { $foosub = Foo::Sub1->new } - 'instantiating concrete subclasses works'; -isa_ok($foosub, 'Foo', 'inheritance is correct'); -my $foosubsub; -lives_ok { $foosubsub = Foo::Sub::Sub->new } - 'instantiating deeper concrete subclasses works'; -isa_ok($foosubsub, 'Foo', 'inheritance is correct'); -isa_ok($foosubsub, 'Foo::Sub1', 'inheritance is correct'); -throws_ok { Foo->new } qr/Foo is abstract, it cannot be instantiated/, - 'instantiating abstract classes fails'; diff --git a/t/003-custom-constructor.t b/t/003-custom-constructor.t deleted file mode 100644 index cb12835..0000000 --- a/t/003-custom-constructor.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 1; - -our $custom_constructor_called = 0; - -package Foo; -use Moose; -use MooseX::ABC; - -requires 'bar', 'baz'; - -package Foo::Sub; -use Moose; -extends 'Foo'; - -sub bar { } -sub baz { } -sub new { $::custom_constructor_called++; shift->SUPER::new(@_) } - -package main; -my $foosub = Foo::Sub->new; -ok($custom_constructor_called, 'custom constructor was called'); diff --git a/t/004-abstract-subclass.t b/t/004-abstract-subclass.t deleted file mode 100644 index 3542d07..0000000 --- a/t/004-abstract-subclass.t +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 3; -use Test::Exception; - -package Foo; -use Moose; -use MooseX::ABC; - -requires 'foo'; -requires 'bar'; - -package Foo::Sub; -use Moose; -use MooseX::ABC; -extends 'Foo'; - -requires 'baz'; - -sub bar { 'BAR' } - -package Foo::Sub::Sub; -use Moose; -extends 'Foo::Sub'; - -sub foo { 'FOO' } -sub baz { 'BAZ' } - -package main; - -dies_ok { Foo->new } "can't create Foo objects"; -dies_ok { Foo::Sub->new } "can't create Foo::Sub objects"; -my $foo = Foo::Sub::Sub->new; -is($foo->foo, 'FOO', 'successfully created a Foo::Sub::Sub object'); diff --git a/t/01-basic.t b/t/01-basic.t new file mode 100644 index 0000000..d5951d4 --- /dev/null +++ b/t/01-basic.t @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 9; +use Test::Exception; + +package Foo; +use Moose; +use MooseX::ABC; + +requires 'bar', 'baz'; + +package Foo::Sub1; +use Moose; +::lives_ok { extends 'Foo' } 'extending works when the requires are fulfilled'; +sub bar { } +sub baz { } + +package Foo::Sub2; +use Moose; +::throws_ok { extends 'Foo' } qr/Foo requires Foo::Sub2 to implement baz/, + 'extending fails with the correct error when requires are not fulfilled'; +sub bar { } + +package Foo::Sub::Sub; +use Moose; +::lives_ok { extends 'Foo::Sub1' } 'extending twice works'; + +package main; +my $foosub; +lives_ok { $foosub = Foo::Sub1->new } + 'instantiating concrete subclasses works'; +isa_ok($foosub, 'Foo', 'inheritance is correct'); +my $foosubsub; +lives_ok { $foosubsub = Foo::Sub::Sub->new } + 'instantiating deeper concrete subclasses works'; +isa_ok($foosubsub, 'Foo', 'inheritance is correct'); +isa_ok($foosubsub, 'Foo::Sub1', 'inheritance is correct'); +throws_ok { Foo->new } qr/Foo is abstract, it cannot be instantiated/, + 'instantiating abstract classes fails'; diff --git a/t/02-immutable.t b/t/02-immutable.t new file mode 100644 index 0000000..66424da --- /dev/null +++ b/t/02-immutable.t @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 9; +use Test::Exception; + +package Foo; +use Moose; +use MooseX::ABC; + +requires 'bar', 'baz'; + +__PACKAGE__->meta->make_immutable; + +package Foo::Sub1; +use Moose; +::lives_ok { extends 'Foo' } 'extending works when the requires are fulfilled'; +sub bar { } +sub baz { } + +__PACKAGE__->meta->make_immutable; + +package Foo::Sub2; +use Moose; +::throws_ok { extends 'Foo' } qr/Foo requires Foo::Sub2 to implement baz/, + 'extending fails with the correct error when requires are not fulfilled'; +sub bar { } + +package Foo::Sub::Sub; +use Moose; +::lives_ok { extends 'Foo::Sub1' } 'extending twice works'; + +__PACKAGE__->meta->make_immutable; + +package main; +my $foosub; +lives_ok { $foosub = Foo::Sub1->new } + 'instantiating concrete subclasses works'; +isa_ok($foosub, 'Foo', 'inheritance is correct'); +my $foosubsub; +lives_ok { $foosubsub = Foo::Sub::Sub->new } + 'instantiating deeper concrete subclasses works'; +isa_ok($foosubsub, 'Foo', 'inheritance is correct'); +isa_ok($foosubsub, 'Foo::Sub1', 'inheritance is correct'); +throws_ok { Foo->new } qr/Foo is abstract, it cannot be instantiated/, + 'instantiating abstract classes fails'; diff --git a/t/03-custom-constructor.t b/t/03-custom-constructor.t new file mode 100644 index 0000000..cb12835 --- /dev/null +++ b/t/03-custom-constructor.t @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 1; + +our $custom_constructor_called = 0; + +package Foo; +use Moose; +use MooseX::ABC; + +requires 'bar', 'baz'; + +package Foo::Sub; +use Moose; +extends 'Foo'; + +sub bar { } +sub baz { } +sub new { $::custom_constructor_called++; shift->SUPER::new(@_) } + +package main; +my $foosub = Foo::Sub->new; +ok($custom_constructor_called, 'custom constructor was called'); diff --git a/t/04-abstract-subclass.t b/t/04-abstract-subclass.t new file mode 100644 index 0000000..3542d07 --- /dev/null +++ b/t/04-abstract-subclass.t @@ -0,0 +1,35 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 3; +use Test::Exception; + +package Foo; +use Moose; +use MooseX::ABC; + +requires 'foo'; +requires 'bar'; + +package Foo::Sub; +use Moose; +use MooseX::ABC; +extends 'Foo'; + +requires 'baz'; + +sub bar { 'BAR' } + +package Foo::Sub::Sub; +use Moose; +extends 'Foo::Sub'; + +sub foo { 'FOO' } +sub baz { 'BAZ' } + +package main; + +dies_ok { Foo->new } "can't create Foo objects"; +dies_ok { Foo::Sub->new } "can't create Foo::Sub objects"; +my $foo = Foo::Sub::Sub->new; +is($foo->foo, 'FOO', 'successfully created a Foo::Sub::Sub object'); diff --git a/weaver.ini b/weaver.ini new file mode 100644 index 0000000..219a165 --- /dev/null +++ b/weaver.ini @@ -0,0 +1,36 @@ +[@CorePrep] + +[Name] +[Version] + +[Region / prelude] + +[Generic / SYNOPSIS] +[Generic / DESCRIPTION] +[Generic / OVERVIEW] + +[Collect / ATTRIBUTES] +command = attr + +[Collect / METHODS] +command = method + +[Collect / FUNCTIONS] +command = func + +[Leftovers] + +[Region / postlude] + +[Template / BUGS] +template = ~/.dzil/pod_templates/bugs.section +main_module_only = 1 + +[SeeAlso] + +[Template / SUPPORT] +template = ~/.dzil/pod_templates/support.section +main_module_only = 1 + +[Authors] +[Legal] -- cgit v1.2.3-54-g00ecf