MooseX-NonMoose-0.26/0000755000175000001440000000000012303222371013113 5ustar doyusersMooseX-NonMoose-0.26/lib/0000755000175000001440000000000012303222371013661 5ustar doyusersMooseX-NonMoose-0.26/lib/MooseX/0000755000175000001440000000000012303222371015073 5ustar doyusersMooseX-NonMoose-0.26/lib/MooseX/NonMoose/0000755000175000001440000000000012303222371016630 5ustar doyusersMooseX-NonMoose-0.26/lib/MooseX/NonMoose/Meta/0000755000175000001440000000000012303222371017516 5ustar doyusersMooseX-NonMoose-0.26/lib/MooseX/NonMoose/Meta/Role/0000755000175000001440000000000012303222371020417 5ustar doyusersMooseX-NonMoose-0.26/lib/MooseX/NonMoose/Meta/Role/Constructor.pm0000644000175000001440000000374312303222371023311 0ustar doyuserspackage MooseX::NonMoose::Meta::Role::Constructor; BEGIN { $MooseX::NonMoose::Meta::Role::Constructor::AUTHORITY = 'cpan:DOY'; } { $MooseX::NonMoose::Meta::Role::Constructor::VERSION = '0.26'; } use Moose::Role 2.0000; # ABSTRACT: constructor method trait for L around can_be_inlined => sub { my $orig = shift; my $self = shift; my $meta = $self->associated_metaclass; my $super_new = $meta->find_method_by_name($self->name); my $super_meta = $super_new->associated_metaclass; if (Moose::Util::find_meta($super_meta)->can('does_role') && Moose::Util::find_meta($super_meta)->does_role('MooseX::NonMoose::Meta::Role::Class')) { return 1; } return $self->$orig(@_); }; no Moose::Role; 1; __END__ =pod =head1 NAME MooseX::NonMoose::Meta::Role::Constructor - constructor method trait for L =head1 VERSION version 0.26 =head1 SYNOPSIS package My::Moose; use Moose (); use Moose::Exporter; Moose::Exporter->setup_import_methods; sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaclass_roles( for_class => $options{for_class}, metaclass_roles => ['MooseX::NonMoose::Meta::Role::Class'], constructor_class_roles => ['MooseX::NonMoose::Meta::Role::Constructor'], ); return Moose::Util::find_meta($options{for_class}); } =head1 DESCRIPTION This trait implements inlining of the constructor for classes using the L metaclass trait; it has no effect unless that trait is also used. See those docs and the docs for L for more information. =head1 AUTHOR Jesse Luehrs =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut MooseX-NonMoose-0.26/lib/MooseX/NonMoose/Meta/Role/Class.pm0000644000175000001440000003311212303222371022022 0ustar doyuserspackage MooseX::NonMoose::Meta::Role::Class; BEGIN { $MooseX::NonMoose::Meta::Role::Class::AUTHORITY = 'cpan:DOY'; } { $MooseX::NonMoose::Meta::Role::Class::VERSION = '0.26'; } use Moose::Role; # ABSTRACT: metaclass trait for L use List::MoreUtils qw(any); use Module::Runtime qw(use_package_optimistically); use Try::Tiny; has has_nonmoose_constructor => ( is => 'rw', isa => 'Bool', default => 0, ); has has_nonmoose_destructor => ( is => 'rw', isa => 'Bool', default => 0, ); # overrides the constructor_name attr that already exists has constructor_name => ( is => 'rw', isa => 'Str', lazy => 1, default => sub { shift->throw_error("No constructor name has been set") }, ); # XXX ugh, really need to fix this in moose around reinitialize => sub { my $orig = shift; my $class = shift; my ($pkg) = @_; my $meta = blessed($pkg) ? $pkg : Moose::Util::find_meta($pkg); $class->$orig( @_, (map { $_->init_arg => $_->get_value($meta) } grep { $_->has_value($meta) } map { $meta->meta->find_attribute_by_name($_) } qw(has_nonmoose_constructor has_nonmoose_destructor constructor_name)), ); }; sub _determine_constructor_options { my $self = shift; my @options = @_; # if we're using just the metaclass trait, but not the constructor trait, # then suppress the warning about not inlining a constructor my $cc_meta = Moose::Util::find_meta($self->constructor_class); return (@options, inline_constructor => 0) unless $cc_meta->can('does_role') && $cc_meta->does_role('MooseX::NonMoose::Meta::Role::Constructor'); # do nothing if we explicitly ask for the constructor to not be inlined my %options = @options; return @options if !$options{inline_constructor}; my $constructor_name = $self->constructor_name; my $local_constructor = $self->get_method($constructor_name); if (!defined($local_constructor)) { warn "Not inlining a constructor for " . $self->name . " since " . "its parent " . ($self->superclasses)[0] . " doesn't contain a " . "constructor named '$constructor_name'. " . "If you are certain you don't need to inline your" . " constructor, specify inline_constructor => 0 in your" . " call to " . $self->name . "->meta->make_immutable\n"; return @options; } # do nothing if extends was called, but we then added a method modifier to # the constructor (this will warn, but that's okay) # XXX: this is a fairly big hack, but it should cover most of the cases # that actually show up in practice... it would be nice to do this properly # though return @options if $local_constructor->isa('Class::MOP::Method::Wrapped'); # otherwise, explicitly ask for the constructor to be replaced (to suppress # the warning message), since this is the expected usage, and shouldn't # cause a warning return (replace_constructor => 1, @options); } sub _determine_destructor_options { my $self = shift; my @options = @_; return (@options, inline_destructor => 0); } around _immutable_options => sub { my $orig = shift; my $self = shift; my @options = $self->$orig(@_); # do nothing if extends was never called return @options if !$self->has_nonmoose_constructor && !$self->has_nonmoose_destructor; @options = $self->_determine_constructor_options(@options); @options = $self->_determine_destructor_options(@options); return @options; }; sub _check_superclass_constructor { my $self = shift; # if the current class defined a custom new method (since subs happen at # BEGIN time), don't try to override it return if $self->has_method($self->constructor_name); # we need to get the non-moose constructor from the superclass # of the class where this method actually exists, regardless of what class # we're calling it on my $super_new = $self->find_next_method_by_name($self->constructor_name); # if we're trying to extend a (non-immutable) moose class, just do nothing return if $super_new->package_name eq 'Moose::Object'; if ($super_new->associated_metaclass->can('constructor_class')) { my $constructor_class_meta = Class::MOP::Class->initialize( $super_new->associated_metaclass->constructor_class ); # if the constructor we're inheriting is already one of ours, there's # no reason to install a new one return if $constructor_class_meta->can('does_role') && $constructor_class_meta->does_role('MooseX::NonMoose::Meta::Role::Constructor'); # if the constructor we're inheriting is an inlined version of the # default moose constructor, don't do anything either return if any { $_->isa($constructor_class_meta->name) } $super_new->associated_metaclass->_inlined_methods; } $self->add_method($self->constructor_name => sub { my $class = shift; my $params = $class->BUILDARGS(@_); my @foreign_params = $class->can('FOREIGNBUILDARGS') ? $class->FOREIGNBUILDARGS(@_) : @_; my $instance = $super_new->execute($class, @foreign_params); if (!blessed($instance)) { confess "The constructor for " . $super_new->associated_metaclass->name . " did not return a blessed instance"; } elsif (!$instance->isa($class)) { if (!$class->isa(blessed($instance))) { confess "The constructor for " . $super_new->associated_metaclass->name . " returned an object whose class is not a parent of " . $class; } else { bless $instance, $class; } } return Class::MOP::Class->initialize($class)->new_object( __INSTANCE__ => $instance, %$params, ); }); $self->has_nonmoose_constructor(1); } sub _check_superclass_destructor { my $self = shift; # if the current class defined a custom DESTROY method (since subs happen # at BEGIN time), don't try to override it return if $self->has_method('DESTROY'); # we need to get the non-moose destructor from the superclass # of the class where this method actually exists, regardless of what class # we're calling it on my $super_DESTROY = $self->find_next_method_by_name('DESTROY'); # if we're trying to extend a (non-immutable) moose class, just do nothing return if $super_DESTROY->package_name eq 'Moose::Object'; if ($super_DESTROY->associated_metaclass->can('destructor_class') && $super_DESTROY->associated_metaclass->destructor_class) { my $destructor_class_meta = Class::MOP::Class->initialize( $super_DESTROY->associated_metaclass->destructor_class ); # if the destructor we're inheriting is an inlined version of the # default moose destructor, don't do anything return if any { $_->isa($destructor_class_meta->name) } $super_DESTROY->associated_metaclass->_inlined_methods; } $self->add_method(DESTROY => sub { my $self = shift; local $?; Try::Tiny::try { $super_DESTROY->execute($self); $self->DEMOLISHALL(Devel::GlobalDestruction::in_global_destruction); } Try::Tiny::catch { # Without this, Perl will warn "\t(in cleanup)$@" because of some # bizarre fucked-up logic deep in the internals. no warnings 'misc'; die $_; }; return; }); $self->has_nonmoose_destructor(1); } around superclasses => sub { my $orig = shift; my $self = shift; return $self->$orig unless @_; # XXX lots of duplication between here and MMC::superclasses my ($constructor_name, $constructor_class); for my $super (@{ Data::OptList::mkopt(\@_) }) { my ($name, $opts) = @{ $super }; my $cur_constructor_name = delete $opts->{'-constructor_name'}; if (defined($constructor_name) && defined($cur_constructor_name)) { $self->throw_error( "You have already specified " . "${constructor_class}::${constructor_name} as the parent " . "constructor; ${name}::${cur_constructor_name} cannot also be " . "the constructor" ); } if ($opts && exists($opts->{-version})) { use_package_optimistically($name, $opts->{-version}); } else { use_package_optimistically($name); } if (defined($cur_constructor_name)) { my $meta = Moose::Util::find_meta($name); $self->throw_error( "You specified '$cur_constructor_name' as the constructor for " . "$name, but $name has no method by that name" ) unless $meta ? $meta->find_method_by_name($cur_constructor_name) : $name->can($cur_constructor_name); } if (!defined($constructor_name)) { $constructor_name = $cur_constructor_name; $constructor_class = $name; } delete $opts->{'-constructor_name'}; } $self->constructor_name( defined($constructor_name) ? $constructor_name : 'new' ); my @superclasses = @_; push @superclasses, 'Moose::Object' unless grep { !ref($_) && $_->isa('Moose::Object') } @superclasses; my @ret = $self->$orig(@superclasses); $self->_check_superclass_constructor; $self->_check_superclass_destructor; return @ret; }; sub _generate_fallback_constructor { my $self = shift; my ($class_var) = @_; my $new = $self->constructor_name; my $super_new_class = $self->_find_next_nonmoose_constructor_package; my $arglist = $self->find_method_by_name('FOREIGNBUILDARGS') ? "${class_var}->FOREIGNBUILDARGS(\@_)" : '@_'; my $instance = "${class_var}->${super_new_class}::$new($arglist)"; # XXX: the "my $__DUMMY = " part is because "return do" triggers a weird # bug in pre-5.12 perls (it ends up returning undef) return '(my $__DUMMY = do { ' . 'if (ref($_[0]) eq \'HASH\') { ' . '$_[0]->{__INSTANCE__} = ' . $instance . ' ' . 'unless exists $_[0]->{__INSTANCE__}; ' . '} ' . 'else { ' . 'unshift @_, __INSTANCE__ => ' . $instance . '; ' . '} ' . $class_var . '->Moose::Object::new(@_); ' . '})'; } sub _inline_generate_instance { my $self = shift; my ($var, $class_var) = @_; my $new = $self->constructor_name; my $super_new_class = $self->_find_next_nonmoose_constructor_package; my $arglist = $self->find_method_by_name('FOREIGNBUILDARGS') ? "${class_var}->FOREIGNBUILDARGS(\@_)" : '@_'; my $instance = "${class_var}->${super_new_class}::$new($arglist)"; return ( 'my ' . $var . ' = ' . $instance . ';', 'if (!Scalar::Util::blessed(' . $var . ')) {', $self->_inline_throw_error( '"The constructor for ' . $super_new_class . ' did not return a blessed instance"', ) . ';', '}', 'elsif (!' . $var . '->isa(' . $class_var . ')) {', 'if (!' . $class_var . '->isa(Scalar::Util::blessed(' . $var . '))) {', $self->_inline_throw_error( '"The constructor for ' . $super_new_class . ' returned an object whose class is not a parent of ' . $class_var . '"', ) . ';', '}', 'else {', $self->_inline_rebless_instance($var, $class_var) . ';', '}', '}', ); } sub _find_next_nonmoose_constructor_package { my $self = shift; my $new = $self->constructor_name; for my $method (map { $_->{code} } $self->find_all_methods_by_name($new)) { next if $method->associated_metaclass->meta->can('does_role') && $method->associated_metaclass->meta->does_role('MooseX::NonMoose::Meta::Role::Class'); return $method->package_name; } # this should never happen (it should find Moose::Object at least) $self->throw_error("Couldn't find a non-Moose constructor for " . $self->name); } no Moose::Role; 1; __END__ =pod =head1 NAME MooseX::NonMoose::Meta::Role::Class - metaclass trait for L =head1 VERSION version 0.26 =head1 SYNOPSIS package Foo; use Moose -traits => 'MooseX::NonMoose::Meta::Role::Class'; # or package My::Moose; use Moose (); use Moose::Exporter; Moose::Exporter->setup_import_methods; sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaclass_roles( for_class => $options{for_class}, metaclass_roles => ['MooseX::NonMoose::Meta::Role::Class'], ); return Moose::Util::find_meta($options{for_class}); } =head1 DESCRIPTION This trait implements everything involved with extending non-Moose classes, other than doing the actual inlining at C time. See L for more details. =head1 AUTHOR Jesse Luehrs =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut MooseX-NonMoose-0.26/lib/MooseX/NonMoose/InsideOut.pm0000644000175000001440000000351212303222371021072 0ustar doyuserspackage MooseX::NonMoose::InsideOut; BEGIN { $MooseX::NonMoose::InsideOut::AUTHORITY = 'cpan:DOY'; } { $MooseX::NonMoose::InsideOut::VERSION = '0.26'; } use Moose::Exporter; # ABSTRACT: easy subclassing of non-Moose non-hashref classes my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods( class_metaroles => { class => ['MooseX::NonMoose::Meta::Role::Class'], constructor => ['MooseX::NonMoose::Meta::Role::Constructor'], instance => ['MooseX::InsideOut::Role::Meta::Instance'], }, install => [qw(import unimport)], ); sub init_meta { my $package = shift; my %options = @_; my $meta = Moose::Util::find_meta($options{for_class}); Carp::cluck('Roles have no use for MooseX::NonMoose') if $meta && $meta->isa('Moose::Meta::Role'); $package->$init_meta(@_); } 1; __END__ =pod =head1 NAME MooseX::NonMoose::InsideOut - easy subclassing of non-Moose non-hashref classes =head1 VERSION version 0.26 =head1 SYNOPSIS package Term::VT102::NBased; use Moose; use MooseX::NonMoose::InsideOut; extends 'Term::VT102'; has [qw/x_base y_base/] => ( is => 'ro', isa => 'Int', default => 1, ); around x => sub { my $orig = shift; my $self = shift; $self->$orig(@_) + $self->x_base - 1; }; # ... (wrap other methods) no Moose; # no need to fiddle with inline_constructor here __PACKAGE__->meta->make_immutable; my $vt = Term::VT102::NBased->new(x_base => 0, y_base => 0); =head1 DESCRIPTION =for Pod::Coverage init_meta =head1 AUTHOR Jesse Luehrs =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut MooseX-NonMoose-0.26/lib/MooseX/NonMoose.pm0000644000175000001440000001373712303222371017201 0ustar doyuserspackage MooseX::NonMoose; BEGIN { $MooseX::NonMoose::AUTHORITY = 'cpan:DOY'; } { $MooseX::NonMoose::VERSION = '0.26'; } use Moose::Exporter; use Moose::Util; # ABSTRACT: easy subclassing of non-Moose classes my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods( class_metaroles => { class => ['MooseX::NonMoose::Meta::Role::Class'], constructor => ['MooseX::NonMoose::Meta::Role::Constructor'], }, install => [qw(import unimport)], ); sub init_meta { my $package = shift; my %options = @_; my $meta = Moose::Util::find_meta($options{for_class}); Carp::cluck('Roles have no use for MooseX::NonMoose') if $meta && $meta->isa('Moose::Meta::Role'); $package->$init_meta(@_); } 1; __END__ =pod =head1 NAME MooseX::NonMoose - easy subclassing of non-Moose classes =head1 VERSION version 0.26 =head1 SYNOPSIS package Term::VT102::NBased; use Moose; use MooseX::NonMoose; extends 'Term::VT102'; has [qw/x_base y_base/] => ( is => 'ro', isa => 'Int', default => 1, ); around x => sub { my $orig = shift; my $self = shift; $self->$orig(@_) + $self->x_base - 1; }; # ... (wrap other methods) no Moose; # no need to fiddle with inline_constructor here __PACKAGE__->meta->make_immutable; my $vt = Term::VT102::NBased->new(x_base => 0, y_base => 0); =head1 DESCRIPTION C allows for easily subclassing non-Moose classes with Moose, taking care of the annoying details connected with doing this, such as setting up proper inheritance from L and installing (and inlining, at C time) a constructor that makes sure things like C methods are called. It tries to be as non-intrusive as possible - when this module is used, inheriting from non-Moose classes and inheriting from Moose classes should work identically, aside from the few caveats mentioned below. One of the goals of this module is that including it in a L-based package used across an entire application should be possible, without interfering with classes that only inherit from Moose modules, or even classes that don't inherit from anything at all. There are several ways to use this module. The most straightforward is to just C in your class; this should set up everything necessary for extending non-Moose modules. L and L can also be applied to your metaclasses manually, either by passing a C<-traits> option to your C line, or by applying them using L in a L-based package. L is the part that provides the main functionality of this module; if you don't care about inlining, this is all you need to worry about. Applying L as well will provide an inlined constructor when you immutabilize your class. C allows you to manipulate the argument list that gets passed to the superclass constructor by defining a C method. This is called with the same argument list as the C method, but should return a list of arguments to pass to the superclass constructor. This allows C to support superclasses whose constructors would get confused by the extra arguments that Moose requires (for attributes, etc.) Not all non-Moose classes use C as the name of their constructor. This module allows you to extend these classes by explicitly stating which method is the constructor, during the call to C. The syntax looks like this: extends 'Foo' => { -constructor_name => 'create' }; similar to how you can already pass C<-version> in the C call in a similar way. =head1 BUGS/CAVEATS =over 4 =item * The reference that the non-Moose class uses as its instance type B match the instance type that Moose is using. Moose's default instance type is a hashref, but other modules exist to make Moose use other instance types. L is the most general solution - it should work with any class. For globref-based classes in particular, L will also allow Moose to work. For more information, see the C<032-moosex-insideout> and C<033-moosex-globref> tests bundled with this dist. =item * Modifying your class' C<@ISA> after an initial C call will potentially cause problems if any of those new entries in the C<@ISA> override the constructor. C wraps the nearest C method at the time C is called and will not see any other C methods in the @ISA hierarchy. =item * Completely overriding the constructor in a class using C (i.e. using C) currently doesn't work, although using method modifiers on the constructor should work identically to normal Moose classes. =back Please report any bugs to GitHub Issues at L. =head1 SEE ALSO =over 4 =item * L =item * L serves the same purpose, but with a radically different (and far more hackish) implementation. =back =head1 SUPPORT You can find this documentation for this module with the perldoc command. perldoc MooseX::NonMoose You can also look for information at: =over 4 =item * MetaCPAN L =item * Github L =item * RT: CPAN's request tracker L =item * CPAN Ratings L =back =for Pod::Coverage init_meta =head1 AUTHOR Jesse Luehrs =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut MooseX-NonMoose-0.26/xt/0000755000175000001440000000000012303222371013546 5ustar doyusersMooseX-NonMoose-0.26/xt/release/0000755000175000001440000000000012303222371015166 5ustar doyusersMooseX-NonMoose-0.26/xt/release/pod-coverage.t0000644000175000001440000000065112303222371017730 0ustar doyusers#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); MooseX-NonMoose-0.26/xt/release/pod-syntax.t0000644000175000001440000000033212303222371017457 0ustar doyusers#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); MooseX-NonMoose-0.26/xt/release/no-tabs.t0000644000175000001440000000055612303222371016724 0ustar doyusersuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::NoTabsTests 0.05 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/MooseX/NonMoose.pm', 'lib/MooseX/NonMoose/InsideOut.pm', 'lib/MooseX/NonMoose/Meta/Role/Class.pm', 'lib/MooseX/NonMoose/Meta/Role/Constructor.pm' ); notabs_ok($_) foreach @files; done_testing; MooseX-NonMoose-0.26/xt/release/eol.t0000644000175000001440000000024012303222371016126 0ustar doyusersuse strict; use warnings; use Test::More; eval 'use Test::EOL'; plan skip_all => 'Test::EOL required' if $@; all_perl_files_ok({ trailing_whitespace => 1 }); MooseX-NonMoose-0.26/Makefile.PL0000644000175000001440000000324512303222371015071 0ustar doyusers # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.008. use strict; use warnings; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "easy subclassing of non-Moose classes", "AUTHOR" => "Jesse Luehrs ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "MooseX-NonMoose", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "MooseX::NonMoose", "PREREQ_PM" => { "List::MoreUtils" => 0, "Module::Runtime" => 0, "Moose::Exporter" => 0, "Moose::Role" => "2.0000", "Moose::Util" => 0, "Try::Tiny" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Moose" => 0, "Test::Fatal" => 0, "Test::Moose" => 0, "Test::More" => "0.88", "base" => 0, "strict" => 0 }, "VERSION" => "0.26", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "List::MoreUtils" => 0, "Module::Runtime" => 0, "Moose" => 0, "Moose::Exporter" => 0, "Moose::Role" => "2.0000", "Moose::Util" => 0, "Test::Fatal" => 0, "Test::Moose" => 0, "Test::More" => "0.88", "Try::Tiny" => 0, "base" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); MooseX-NonMoose-0.26/META.json0000644000175000001440000002653412303222371014546 0ustar doyusers{ "abstract" : "easy subclassing of non-Moose classes", "author" : [ "Jesse Luehrs " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.008, CPAN::Meta::Converter version 2.132830", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "MooseX-NonMoose", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "MooseX::GlobRef" : "0", "MooseX::InsideOut" : "0", "Pod::Coverage::TrustPod" : "0", "Test::More" : "0", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "List::MoreUtils" : "0", "Module::Runtime" : "0", "Moose::Exporter" : "0", "Moose::Role" : "2.0000", "Moose::Util" : "0", "Try::Tiny" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Moose" : "0", "Test::Fatal" : "0", "Test::Moose" : "0", "Test::More" : "0.88", "base" : "0", "strict" : "0" } } }, "provides" : { "MooseX::NonMoose" : { "file" : "lib/MooseX/NonMoose.pm", "version" : "0.26" }, "MooseX::NonMoose::InsideOut" : { "file" : "lib/MooseX/NonMoose/InsideOut.pm", "version" : "0.26" }, "MooseX::NonMoose::Meta::Role::Class" : { "file" : "lib/MooseX/NonMoose/Meta/Role/Class.pm", "version" : "0.26" }, "MooseX::NonMoose::Meta::Role::Constructor" : { "file" : "lib/MooseX/NonMoose/Meta/Role/Constructor.pm", "version" : "0.26" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/doy/moosex-nonmoose/issues" }, "homepage" : "http://metacpan.org/release/MooseX-NonMoose", "repository" : { "type" : "git", "url" : "git://github.com/doy/moosex-nonmoose.git", "web" : "https://github.com/doy/moosex-nonmoose" } }, "version" : "0.26", "x_Dist_Zilla" : { "perl" : { "version" : "5.018001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@DOY/TestMoreDoneTesting", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "name" : "@DOY/GatherDir", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@DOY/PruneCruft", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@DOY/ManifestSkip", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@DOY/MetaYAML", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@DOY/License", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@DOY/Readme", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "name" : "@DOY/RunExtraTests", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@DOY/ExecDir", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@DOY/ShareDir", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "name" : "@DOY/MakeMaker", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@DOY/Manifest", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@DOY/TestRelease", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@DOY/ConfirmRelease", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@DOY/MetaConfig", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@DOY/MetaJSON", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@DOY/NextRelease", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@DOY/CheckChangesHasContent", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@DOY/PkgVersion", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@DOY/Authority", "version" : "1.006" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@DOY/PodCoverageTests", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@DOY/PodSyntaxTests", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::NoTabsTests", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "module_finder" : [ ":InstallModules" ], "script_finder" : [ ":ExecFiles" ] } }, "name" : "@DOY/NoTabsTests", "version" : "0.05" }, { "class" : "Dist::Zilla::Plugin::EOLTests", "name" : "@DOY/EOLTests", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "script_finder" : [ ":ExecFiles" ] } }, "name" : "@DOY/Test::Compile", "version" : "2.037" }, { "class" : "Dist::Zilla::Plugin::Metadata", "name" : "@DOY/Metadata", "version" : "3.03" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@DOY/MetaResources", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "name" : "@DOY/Git::Check", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "name" : "@DOY/Git::Commit", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "name" : "@DOY/Git::Tag", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "name" : "@DOY/Git::NextVersion", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::ContributorsFromGit", "name" : "@DOY/ContributorsFromGit", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : {}, "Dist::Zilla::Role::MetaProvider::Provider" : { "inherit_missing" : "1", "inherit_version" : "1", "meta_noindex" : "1" } }, "name" : "@DOY/MetaProvides::Package", "version" : "1.15000000" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "name" : "@DOY/PodWeaver", "version" : "3.101641" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@DOY/UploadToCPAN", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "AutoPrereqs", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "DevelopRequires", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "5.008" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.008" } }, "x_authority" : "cpan:DOY", "x_contributors" : [ "Brian Phillips ", "Dave Rolsky ", "Florian Ragwitz ", "Gareth Harper ", "Hans Dieter Pearcey ", "Jason May ", "Karen Etheridge ", "fschlich " ] } MooseX-NonMoose-0.26/t/0000755000175000001440000000000012303222371013356 5ustar doyusersMooseX-NonMoose-0.26/t/buggy-constructor-inlining.t0000644000175000001440000000115312303222371021050 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; my ($Foo, $Bar, $Baz); { package Foo; sub new { $Foo++; bless {}, shift } } { package Bar; use Moose; use MooseX::NonMoose; extends 'Foo'; sub BUILD { $Bar++ } __PACKAGE__->meta->make_immutable; } { package Baz; use Moose; extends 'Bar'; sub BUILD { $Baz++ } } with_immutable { ($Foo, $Bar, $Baz) = (0, 0, 0); Baz->new; is($Foo, 1, "Foo->new is called once"); is($Bar, 1, "Bar->BUILD is called once"); is($Baz, 1, "Baz->BUILD is called once"); } 'Baz'; done_testing; MooseX-NonMoose-0.26/t/constructor-method-calls.t0000644000175000001440000000124512303222371020504 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; my ($foo, $foosub); { package Foo; sub new { my $class = shift; my $obj = bless {}, $class; $obj->init; $obj; } sub init { $foo++ } } { package Foo::Sub; use base 'Foo'; sub init { $foosub++; shift->SUPER::init; } } { package Foo::Sub::Sub; use Moose; use MooseX::NonMoose; extends 'Foo::Sub'; } with_immutable { ($foo, $foosub) = (0, 0); Foo::Sub::Sub->new; is($foo, 1, "Foo::init called"); is($foosub, 1, "Foo::Sub::init called"); } 'Foo::Sub::Sub'; done_testing; MooseX-NonMoose-0.26/t/no-new-constructor-error.t0000644000175000001440000000171312303222371020462 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; { package NonMoose; sub create { bless {}, shift } sub DESTROY { } } { package Child; use Moose; use MooseX::NonMoose; extends 'NonMoose'; { my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; __PACKAGE__->meta->make_immutable; ::like( $warning, qr/Not inlining.*doesn't contain a constructor named 'new'/, "warning when trying to make_immutable without a superclass 'new'" ); } } { package ChildTwo; use Moose; use MooseX::NonMoose; extends 'NonMoose'; { my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; __PACKAGE__->meta->make_immutable(inline_constructor => 0); ::is($warning, undef, "no warning when trying to make_immutable(inline_constructor => 0) without a superclass 'new'"); } } done_testing; MooseX-NonMoose-0.26/t/nonmoose-moose-nonmoose.t0000644000175000001440000000357712303222371020367 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; package Foo; sub new { my $class = shift; bless {@_}, $class; } sub foo { shift->{name} } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has foo2 => ( is => 'rw', isa => 'Str', ); package Foo::Moose::Sub; use base 'Foo::Moose'; package Bar; sub new { my $class = shift; bless {name => $_[0]}, $class; } sub bar { shift->{name} } package Bar::Moose; use Moose; use MooseX::NonMoose; extends 'Bar'; has bar2 => ( is => 'rw', isa => 'Str', ); sub FOREIGNBUILDARGS { my $class = shift; my %args = @_; return $args{name}; } package Bar::Moose::Sub; use base 'Bar::Moose'; package main; with_immutable { my $foo = Foo::Moose::Sub->new(name => 'foomoosesub', foo2 => 'FOO2'); isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Moose'); is($foo->foo, 'foomoosesub', 'got name from nonmoose constructor'); is($foo->foo2, 'FOO2', 'got attribute value from moose constructor'); $foo = Foo::Moose->new(name => 'foomoosesub', foo2 => 'FOO2'); isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Moose'); is($foo->foo, 'foomoosesub', 'got name from nonmoose constructor'); is($foo->foo2, 'FOO2', 'got attribute value from moose constructor'); } 'Foo::Moose'; with_immutable { my $bar = Bar::Moose::Sub->new(name => 'barmoosesub', bar2 => 'BAR2'); isa_ok($bar, 'Bar'); isa_ok($bar, 'Bar::Moose'); is($bar->bar, 'barmoosesub', 'got name from nonmoose constructor'); is($bar->bar2, 'BAR2', 'got attribute value from moose constructor'); $bar = Bar::Moose->new(name => 'barmoosesub', bar2 => 'BAR2'); isa_ok($bar, 'Bar'); isa_ok($bar, 'Bar::Moose'); is($bar->bar, 'barmoosesub', 'got name from nonmoose constructor'); is($bar->bar2, 'BAR2', 'got attribute value from moose constructor'); } 'Bar::Moose'; done_testing; MooseX-NonMoose-0.26/t/only-metaclass-trait.t0000644000175000001440000000115212303222371017616 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { bless {}, shift } package Foo::Moose; use Moose -traits => 'MooseX::NonMoose::Meta::Role::Class'; extends 'Foo'; package main; ok(Foo::Moose->meta->has_method('new'), 'using only the metaclass trait still installs the constructor'); isa_ok(Foo::Moose->new, 'Moose::Object'); isa_ok(Foo::Moose->new, 'Foo'); my $method = Foo::Moose->meta->get_method('new'); Foo::Moose->meta->make_immutable; is(Foo::Moose->meta->get_method('new'), $method, 'inlining doesn\'t happen when the constructor trait isn\'t used'); done_testing; MooseX-NonMoose-0.26/t/replaced-constructor.t0000644000175000001440000000316012303222371017705 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; our $foo_constructed = 0; package Foo; sub new { my $class = shift; bless {}, $class; } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; after new => sub { $main::foo_constructed = 1; }; package Foo::Moose2; use Moose; use MooseX::NonMoose; extends 'Foo'; sub new { my $class = shift; $main::foo_constructed = 1; return $class->meta->new_object(@_); } package main; my $method = Foo::Moose->meta->get_method('new'); isa_ok($method, 'Class::MOP::Method::Wrapped'); my $foo = Foo::Moose->new; ok($foo_constructed, 'method modifier called for the constructor'); $foo_constructed = 0; { # we don't care about the warning that moose isn't going to inline our # constructor - this is the behavior we're testing local $SIG{__WARN__} = sub {}; Foo::Moose->meta->make_immutable; } is($method, Foo::Moose->meta->get_method('new'), 'make_immutable doesn\'t overwrite constructor with method modifiers'); $foo = Foo::Moose->new; ok($foo_constructed, 'method modifier called for the constructor (immutable)'); $foo_constructed = 0; $method = Foo::Moose2->meta->get_method('new'); $foo = Foo::Moose2->new; ok($foo_constructed, 'custom constructor called'); $foo_constructed = 0; # still need to specify inline_constructor => 0 when overriding new manually Foo::Moose2->meta->make_immutable(inline_constructor => 0); is($method, Foo::Moose2->meta->get_method('new'), 'make_immutable doesn\'t overwrite custom constructor'); $foo = Foo::Moose2->new; ok($foo_constructed, 'custom constructor called (immutable)'); done_testing; MooseX-NonMoose-0.26/t/extends-moose-object.t0000644000175000001440000000075312303222371017606 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; { package Foo; sub new { bless {}, shift } } { package Foo::Sub; use Moose; use MooseX::NonMoose; extends 'Foo'; } { package Bar; use Moose; } { package Bar::Sub; use Moose; use MooseX::NonMoose; extends 'Bar'; } is_deeply(\@Foo::Sub::ISA, ['Foo', 'Moose::Object'], "Moose::Object was added"); is_deeply(\@Bar::Sub::ISA, ['Bar'], "Moose::Object wasn't added"); done_testing; MooseX-NonMoose-0.26/t/hashref-constructor.t0000644000175000001440000000213212303222371017544 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; { package Foo; sub new { my $class = shift; bless { ref($_[0]) ? %{$_[0]} : @_ }, $class; } sub foo { my $self = shift; $self->{foo}; } } { package Bar; use Moose; use MooseX::NonMoose; extends 'Foo'; has _bar => ( init_arg => 'bar', reader => 'bar', ); __PACKAGE__->meta->make_immutable; } { package Baz; use Moose; extends 'Bar'; has _baz => ( init_arg => 'baz', reader => 'baz', ); } { my $baz; is(exception { $baz = Baz->new( foo => 1, bar => 2, baz => 3 ) }, undef, "constructor lives"); is($baz->foo, 1, "foo set"); is($baz->bar, 2, "bar set"); is($baz->baz, 3, "baz set"); } { my $baz; is(exception { $baz = Baz->new({foo => 1, bar => 2, baz => 3}) }, undef, "constructor lives (hashref)"); is($baz->foo, 1, "foo set (hashref)"); is($baz->bar, 2, "bar set (hashref)"); is($baz->baz, 3, "baz set (hashref)"); } done_testing; MooseX-NonMoose-0.26/t/buggy-constructors.t0000644000175000001440000000327612303222371017436 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; use Test::Moose; { package Foo; sub new { bless {}, shift } } { package Foo::Sub; use Moose; use MooseX::NonMoose; extends 'Foo'; } with_immutable { my $foo; is(exception { $foo = Foo::Sub->new }, undef, "subclassing nonmoose classes with correct constructors works"); isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Sub'); } 'Foo::Sub'; { package BadFoo; sub new { bless {} } } { package BadFoo::Sub; use Moose; use MooseX::NonMoose; extends 'BadFoo'; } with_immutable { my $foo; is(exception { $foo = BadFoo::Sub->new }, undef, "subclassing nonmoose classes with incorrect constructors works"); isa_ok($foo, 'BadFoo'); isa_ok($foo, 'BadFoo::Sub'); } 'BadFoo::Sub'; { package BadFoo2; sub new { {} } } { package BadFoo2::Sub; use Moose; use MooseX::NonMoose; extends 'BadFoo2'; } with_immutable { my $foo; like(exception { $foo = BadFoo2::Sub->new; }, qr/\QThe constructor for BadFoo2 did not return a blessed instance/, "subclassing nonmoose classes with incorrect constructors dies properly"); } 'BadFoo2::Sub'; { package BadFoo3; sub new { bless {}, 'Something::Else::Entirely' } } { package BadFoo3::Sub; use Moose; use MooseX::NonMoose; extends 'BadFoo3'; } with_immutable { my $foo; like(exception { $foo = BadFoo3::Sub->new }, qr/\QThe constructor for BadFoo3 returned an object whose class is not a parent of BadFoo3::Sub/, "subclassing nonmoose classes with incorrect constructors dies properly"); } 'BadFoo3::Sub'; done_testing; MooseX-NonMoose-0.26/t/constructor-name.t0000644000175000001440000000421612303222371017051 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; use Test::Moose; { package Foo; sub create { my $class = shift; my %params = @_; bless { foo => ($params{foo} || 'FOO') }, $class; } sub foo { shift->{foo} } } { package Foo::Sub; use Moose; use MooseX::NonMoose; extends 'Foo' => { -constructor_name => 'create' }; has bar => ( is => 'ro', isa => 'Str', default => 'BAR', ); } with_immutable { my $foo = Foo::Sub->create; is($foo->foo, 'FOO', "nonmoose constructor called"); is($foo->bar, 'BAR', "moose constructor called"); } 'Foo::Sub'; { package Foo::BadSub; use Moose; use MooseX::NonMoose; ::like( ::exception { extends 'Foo' => { -constructor_name => 'something_else' }; }, qr/You specified 'something_else' as the constructor for Foo, but Foo has no method by that name/, "specifying an incorrect constructor name dies" ); } { package Foo::Mixin; sub thing { return shift->foo . 'BAZ'; } } { package Foo::Sub2; use Moose; use MooseX::NonMoose; extends 'Foo::Mixin', 'Foo' => { -constructor_name => 'create' }; has bar => ( is => 'ro', isa => 'Str', default => 'BAR', ); } with_immutable { my $foo = Foo::Sub2->create; is($foo->foo, 'FOO', "nonmoose constructor called"); is($foo->bar, 'BAR', "moose constructor called"); is($foo->thing, 'FOOBAZ', "mixin still works"); } 'Foo::Sub2'; { package Bar; sub make { my $class = shift; my %params = @_; bless { baz => ($params{baz} || 'BAZ') }, $class; } } { package Foo::Bar::Sub; use Moose; use MooseX::NonMoose; ::like( ::exception { extends 'Bar' => { -constructor_name => 'make' }, 'Foo' => { -constructor_name => 'create' }; }, qr/You have already specified Bar::make as the parent constructor; Foo::create cannot also be the constructor/, "can't specify two parent constructors" ); } done_testing; MooseX-NonMoose-0.26/t/FOREIGNBUILDARGS.t0000644000175000001440000000267112303222371016077 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; package Foo; sub new { my $class = shift; bless { foo_base => $_[0] }, $class; } sub foo_base { shift->{foo_base} } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has foo => ( is => 'rw', ); sub FOREIGNBUILDARGS { my $class = shift; my %args = @_; return "$args{foo}_base"; } package Bar::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has bar => ( is => 'rw', ); sub FOREIGNBUILDARGS { my $class = shift; return "$_[0]_base"; } sub BUILDARGS { my $class = shift; return { bar => shift }; } package Baz::Moose; use Moose; extends 'Bar::Moose'; has baz => ( is => 'rw', ); package main; with_immutable { my $foo = Foo::Moose->new(foo => 'bar'); is($foo->foo, 'bar', 'subclass constructor gets the right args'); is($foo->foo_base, 'bar_base', 'subclass constructor gets the right args'); my $bar = Bar::Moose->new('baz'); is($bar->bar, 'baz', 'subclass constructor gets the right args'); is($bar->foo_base, 'baz_base', 'subclass constructor gets the right args'); my $baz = Baz::Moose->new('bazbaz'); is($baz->bar, 'bazbaz', 'extensions of extensions of the nonmoose class respect BUILDARGS'); is($baz->foo_base, 'bazbaz_base', 'extensions of extensions of the nonmoose class respect FOREIGNBUILDARGS'); } qw(Foo::Moose Bar::Moose Baz::Moose); done_testing; MooseX-NonMoose-0.26/t/moosex-insideout.t0000644000175000001440000000353612303222371017065 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; BEGIN { eval "use MooseX::InsideOut 0.100 ()"; plan skip_all => "MooseX::InsideOut is required for this test" if $@; } BEGIN { require Moose; package Foo::Exporter; use Moose::Exporter; Moose::Exporter->setup_import_methods(also => ['Moose']); sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaroles( for => $options{for_class}, class_metaroles => { class => ['MooseX::NonMoose::Meta::Role::Class'], constructor => ['MooseX::NonMoose::Meta::Role::Constructor'], instance => ['MooseX::InsideOut::Role::Meta::Instance'], }, ); return Moose::Util::find_meta($options{for_class}); } } package Foo; sub new { my $class = shift; bless [$_[0]], $class; } sub foo { my $self = shift; $self->[0] = shift if @_; $self->[0]; } package Foo::Moose; BEGIN { Foo::Exporter->import } extends 'Foo'; has bar => ( is => 'rw', isa => 'Str', ); sub BUILDARGS { my $self = shift; shift; return $self->SUPER::BUILDARGS(@_); } package Foo::Moose::Sub; use base 'Foo::Moose'; package main; with_immutable { my $foo = Foo::Moose->new('FOO', bar => 'BAR'); is($foo->foo, 'FOO', 'base class accessor works'); is($foo->bar, 'BAR', 'subclass accessor works'); $foo->foo('OOF'); $foo->bar('RAB'); is($foo->foo, 'OOF', 'base class accessor works (setting)'); is($foo->bar, 'RAB', 'subclass accessor works (setting)'); my $sub_foo = eval { Foo::Moose::Sub->new(FOO => bar => 'AHOY') }; is(eval { $sub_foo->bar }, 'AHOY', 'subclass constructor works'); } 'Foo::Moose'; done_testing; MooseX-NonMoose-0.26/t/extends-version.t0000644000175000001440000000056712303222371016710 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; { package Foo; our $VERSION = '0.02'; sub new { bless {}, shift } } { package Bar; use Moose; use MooseX::NonMoose; ::is(::exception { extends 'Foo' => { -version => '0.02' } }, undef, "specifying arguments to superclasses doesn't break"); } done_testing; MooseX-NonMoose-0.26/t/moosex-globref.t0000644000175000001440000000420712303222371016476 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; BEGIN { eval "use MooseX::GlobRef ()"; plan skip_all => "MooseX::GlobRef is required for this test" if $@; } # XXX: the way the IO modules are loaded means we can't just rely on cmop to # load these properly/: use IO::Handle; use IO::File; BEGIN { require Moose; package Foo::Exporter; use Moose::Exporter; Moose::Exporter->setup_import_methods(also => ['Moose']); sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaroles( for => $options{for_class}, class_metaroles => { class => ['MooseX::NonMoose::Meta::Role::Class'], constructor => ['MooseX::NonMoose::Meta::Role::Constructor'], instance => ['MooseX::GlobRef::Role::Meta::Instance'], }, ); return Moose::Util::find_meta($options{for_class}); } } package IO::Handle::Moose; BEGIN { Foo::Exporter->import } extends 'IO::Handle'; has bar => ( is => 'rw', isa => 'Str', ); sub FOREIGNBUILDARGS { return } package IO::File::Moose; BEGIN { Foo::Exporter->import } extends 'IO::File'; has baz => ( is => 'rw', isa => 'Str', ); sub FOREIGNBUILDARGS { return } package main; with_immutable { my $handle = IO::Handle::Moose->new(bar => 'BAR'); is($handle->bar, 'BAR', 'moose accessor works properly'); $handle->bar('RAB'); is($handle->bar, 'RAB', 'moose accessor works properly (setting)'); } 'IO::Handle::Moose'; with_immutable { SKIP: { my $fh = IO::File::Moose->new(baz => 'BAZ'); open $fh, "+>", undef or skip "couldn't open a temporary file", 3; is($fh->baz, 'BAZ', "accessor works"); $fh->baz('ZAB'); is($fh->baz, 'ZAB', "accessor works (writing)"); $fh->print("foo\n"); print $fh "bar\n"; $fh->seek(0, 0); my $buf; $fh->read($buf, 8); is($buf, "foo\nbar\n", "filehandle still works as normal"); } } 'IO::File::Moose'; done_testing; MooseX-NonMoose-0.26/t/moose-exporter.t0000644000175000001440000000430112303222371016531 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; BEGIN { require Moose; package Foo::Exporter::Class; use Moose::Exporter; Moose::Exporter->setup_import_methods(also => ['Moose']); sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaroles( for => $options{for_class}, class_metaroles => { class => ['MooseX::NonMoose::Meta::Role::Class'], }, ); return Moose::Util::find_meta($options{for_class}); } package Foo::Exporter::ClassAndConstructor; use Moose::Exporter; Moose::Exporter->setup_import_methods(also => ['Moose']); sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaroles( for => $options{for_class}, class_metaroles => { class => ['MooseX::NonMoose::Meta::Role::Class'], constructor => ['MooseX::NonMoose::Meta::Role::Constructor'], }, ); return Moose::Util::find_meta($options{for_class}); } } package Foo; sub new { bless {}, shift } package Foo::Moose; BEGIN { Foo::Exporter::Class->import } extends 'Foo'; package Foo::Moose2; BEGIN { Foo::Exporter::ClassAndConstructor->import } extends 'Foo'; package main; ok(Foo::Moose->meta->has_method('new'), 'using only the metaclass trait still installs the constructor'); isa_ok(Foo::Moose->new, 'Moose::Object'); isa_ok(Foo::Moose->new, 'Foo'); my $method = Foo::Moose->meta->get_method('new'); Foo::Moose->meta->make_immutable; is(Foo::Moose->meta->get_method('new'), $method, 'inlining doesn\'t happen when the constructor trait isn\'t used'); ok(Foo::Moose2->meta->has_method('new'), 'using only the metaclass trait still installs the constructor'); isa_ok(Foo::Moose2->new, 'Moose::Object'); isa_ok(Foo::Moose2->new, 'Foo'); my $method2 = Foo::Moose2->meta->get_method('new'); Foo::Moose2->meta->make_immutable; isnt(Foo::Moose2->meta->get_method('new'), $method2, 'inlining does happen when the constructor trait is used'); done_testing; MooseX-NonMoose-0.26/t/reinitialize.t0000644000175000001440000000107512303222371016236 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; { package Foo; sub new { bless {}, shift } } { package Foo::Meta::Role; use Moose::Role; } { package Foo::Sub; use Moose; use MooseX::NonMoose; extends 'Foo'; Moose::Util::MetaRole::apply_metaroles( for => __PACKAGE__, class_metaroles => { class => ['Foo::Meta::Role'], }, ); ::is(::exception { __PACKAGE__->meta->make_immutable }, undef, "can make_immutable after reinitialization"); } done_testing; MooseX-NonMoose-0.26/t/multi-level.t0000644000175000001440000000261712303222371016010 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { my $class = shift; bless { foo => 'FOO' }, $class; } sub foo { shift->{foo} } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has bar => ( is => 'ro', default => 'BAR', ); package Foo::Moose::Sub; use Moose; extends 'Foo::Moose'; has baz => ( is => 'ro', default => 'BAZ', ); package main; my $foo_moose = Foo::Moose->new; is($foo_moose->foo, 'FOO', 'Foo::Moose::foo'); is($foo_moose->bar, 'BAR', 'Foo::Moose::bar'); isnt(Foo::Moose->meta->get_method('new'), undef, 'Foo::Moose gets its own constructor'); my $foo_moose_sub = Foo::Moose::Sub->new; is($foo_moose_sub->foo, 'FOO', 'Foo::Moose::Sub::foo'); is($foo_moose_sub->bar, 'BAR', 'Foo::Moose::Sub::bar'); is($foo_moose_sub->baz, 'BAZ', 'Foo::Moose::Sub::baz'); is(Foo::Moose::Sub->meta->get_method('new'), undef, 'Foo::Moose::Sub just uses the constructor for Foo::Moose'); Foo::Moose->meta->make_immutable; Foo::Moose::Sub->meta->make_immutable; $foo_moose_sub = Foo::Moose::Sub->new; is($foo_moose_sub->foo, 'FOO', 'Foo::Moose::Sub::foo (immutable)'); is($foo_moose_sub->bar, 'BAR', 'Foo::Moose::Sub::bar (immutable)'); is($foo_moose_sub->baz, 'BAZ', 'Foo::Moose::Sub::baz (immutable)'); isnt(Foo::Moose::Sub->meta->get_method('new'), undef, 'Foo::Moose::Sub has an inlined constructor'); done_testing; MooseX-NonMoose-0.26/t/00-compile.t0000644000175000001440000000211212303222371015404 0ustar doyusersuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.037 use Test::More tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'MooseX/NonMoose.pm', 'MooseX/NonMoose/InsideOut.pm', 'MooseX/NonMoose/Meta/Role/Class.pm', 'MooseX/NonMoose/Meta/Role/Constructor.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; my @warnings; for my $lib (@module_files) { # see L open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING}; MooseX-NonMoose-0.26/t/destructor.t0000644000175000001440000000077612303222371015753 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; my ($destroyed, $demolished); package Foo; sub new { bless {}, shift } sub DESTROY { $destroyed++ } package Foo::Sub; use Moose; use MooseX::NonMoose; extends 'Foo'; sub DEMOLISH { $demolished++ } package main; with_immutable { ($destroyed, $demolished) = (0, 0); { Foo::Sub->new } is($destroyed, 1, "non-Moose destructor called"); is($demolished, 1, "Moose destructor called"); } 'Foo::Sub'; done_testing; MooseX-NonMoose-0.26/t/immutable.t0000644000175000001440000000153512303222371015526 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { my $class = shift; bless { @_ }, $class; } sub foo { my $self = shift; return $self->{foo} unless @_; $self->{foo} = shift; } sub baz { 'Foo' } sub quux { ref(shift) } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has bar => ( is => 'rw', ); __PACKAGE__->meta->make_immutable; package main; my $foo_moose = Foo::Moose->new(foo => 'FOO', bar => 'BAR'); is($foo_moose->foo, 'FOO', 'foo set in constructor'); is($foo_moose->bar, 'BAR', 'bar set in constructor'); $foo_moose->foo('BAZ'); $foo_moose->bar('QUUX'); is($foo_moose->foo, 'BAZ', 'foo set by accessor'); is($foo_moose->bar, 'QUUX', 'bar set by accessor'); is($foo_moose->baz, 'Foo', 'baz method'); is($foo_moose->quux, 'Foo::Moose', 'quux method'); done_testing; MooseX-NonMoose-0.26/t/BUILDARGS.t0000644000175000001440000000133212303222371015056 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Moose; package Foo; sub new { my $class = shift; bless { name => $_[0] }, $class; } sub name { shift->{name} } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has foo => ( is => 'rw', ); sub BUILDARGS { my $class = shift; # remove the argument that's only for passing to the superclass constructor shift; return $class->SUPER::BUILDARGS(@_); } package main; with_immutable { my $foo = Foo::Moose->new('bar', foo => 'baz'); is($foo->name, 'bar', 'superclass constructor gets the right args'); is($foo->foo, 'baz', 'subclass constructor gets the right args'); } 'Foo::Moose'; done_testing; MooseX-NonMoose-0.26/t/methods.t0000644000175000001440000000073612303222371015214 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { bless {}, shift } sub foo { 'Foo' } sub bar { 'Foo' } sub baz { ref(shift) } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; sub bar { 'Foo::Moose' } package main; my $foo_moose = Foo::Moose->new; is($foo_moose->foo, 'Foo', 'Foo::Moose->foo'); is($foo_moose->bar, 'Foo::Moose', 'Foo::Moose->bar'); is($foo_moose->baz, 'Foo::Moose', 'Foo::Moose->baz'); done_testing; MooseX-NonMoose-0.26/t/disable.t0000644000175000001440000000146712303222371015156 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { my $class = shift; bless {}, $class; } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; package Foo::Moose2; use Moose; use MooseX::NonMoose; extends 'Foo'; package main; ok(Foo::Moose->meta->has_method('new'), 'Foo::Moose has a constructor'); my $method = Foo::Moose->meta->get_method('new'); Foo::Moose->meta->make_immutable; isnt($method, Foo::Moose->meta->get_method('new'), 'make_immutable replaced the constructor with an inlined version'); my $method2 = Foo::Moose2->meta->get_method('new'); Foo::Moose2->meta->make_immutable(inline_constructor => 0); is($method2, Foo::Moose2->meta->get_method('new'), 'make_immutable doesn\'t replace the constructor if we ask it not to'); done_testing; MooseX-NonMoose-0.26/t/attrs.t0000644000175000001440000000126012303222371014677 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { my $class = shift; bless { @_ }, $class; } sub foo { my $self = shift; return $self->{foo} unless @_; $self->{foo} = shift; } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has bar => ( is => 'rw', ); package main; my $foo_moose = Foo::Moose->new(foo => 'FOO', bar => 'BAR'); is($foo_moose->foo, 'FOO', 'foo set in constructor'); is($foo_moose->bar, 'BAR', 'bar set in constructor'); $foo_moose->foo('BAZ'); $foo_moose->bar('QUUX'); is($foo_moose->foo, 'BAZ', 'foo set by accessor'); is($foo_moose->bar, 'QUUX', 'bar set by accessor'); done_testing; MooseX-NonMoose-0.26/t/moose.t0000644000175000001440000000244412303222371014671 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; use Moose; has foo => ( is => 'ro', default => 'FOO', ); package Foo::Sub; use Moose; use MooseX::NonMoose; extends 'Foo'; package main; my $foo_sub = Foo::Sub->new; isa_ok($foo_sub, 'Foo'); is($foo_sub->foo, 'FOO', 'inheritance works'); ok(!Foo::Sub->meta->has_method('new'), 'Foo::Sub doesn\'t have its own new method'); $_->meta->make_immutable for qw(Foo Foo::Sub); $foo_sub = Foo::Sub->new; isa_ok($foo_sub, 'Foo'); is($foo_sub->foo, 'FOO', 'inheritance works (immutable)'); ok(Foo::Sub->meta->has_method('new'), 'Foo::Sub has its own new method (immutable)'); package Foo::OtherSub; use Moose; use MooseX::NonMoose; extends 'Foo'; package main; my $foo_othersub = Foo::OtherSub->new; isa_ok($foo_othersub, 'Foo'); is($foo_othersub->foo, 'FOO', 'inheritance works (immutable when extending)'); ok(!Foo::OtherSub->meta->has_method('new'), 'Foo::OtherSub doesn\'t have its own new method (immutable when extending)'); Foo::OtherSub->meta->make_immutable; $foo_othersub = Foo::OtherSub->new; isa_ok($foo_othersub, 'Foo'); is($foo_othersub->foo, 'FOO', 'inheritance works (all immutable)'); ok(Foo::OtherSub->meta->has_method('new'), 'Foo::OtherSub has its own new method (all immutable)'); done_testing; MooseX-NonMoose-0.26/t/BUILD.t0000644000175000001440000000206512303222371014405 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { my $class = shift; bless { foo => 'FOO' }, $class; } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; has class => ( is => 'rw', ); has accum => ( is => 'rw', isa => 'Str', default => '', ); sub BUILD { my $self = shift; $self->class(ref $self); $self->accum($self->accum . 'a'); } package Foo::Moose::Sub; use Moose; extends 'Foo::Moose'; has bar => ( is => 'rw', ); sub BUILD { my $self = shift; $self->bar('BAR'); $self->accum($self->accum . 'b'); } package main; my $foo_moose = Foo::Moose->new; is($foo_moose->class, 'Foo::Moose', 'BUILD method called properly'); is($foo_moose->accum, 'a', 'BUILD method called properly'); my $foo_moose_sub = Foo::Moose::Sub->new; is($foo_moose_sub->class, 'Foo::Moose::Sub', 'parent BUILD method called'); is($foo_moose_sub->bar, 'BAR', 'child BUILD method called'); is($foo_moose_sub->accum, 'ab', 'BUILD methods called in the correct order'); done_testing; MooseX-NonMoose-0.26/t/basic.t0000644000175000001440000000154612303222371014632 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; package Foo; sub new { my $class = shift; bless { _class => $class }, $class; } package Foo::Moose; use Moose; use MooseX::NonMoose; extends 'Foo'; package main; my $foo = Foo->new; my $foo_moose = Foo::Moose->new; isa_ok($foo, 'Foo'); is($foo->{_class}, 'Foo', 'Foo gets the correct class'); isa_ok($foo_moose, 'Foo::Moose'); isa_ok($foo_moose, 'Foo'); isa_ok($foo_moose, 'Moose::Object'); is($foo_moose->{_class}, 'Foo::Moose', 'Foo::Moose gets the correct class'); my $meta = Foo::Moose->meta; ok($meta->has_method('new'), 'Foo::Moose has its own constructor'); my $cc_meta = $meta->constructor_class->meta; isa_ok($cc_meta, 'Moose::Meta::Class'); ok($cc_meta->does_role('MooseX::NonMoose::Meta::Role::Constructor'), 'Foo::Moose gets its constructor from MooseX::NonMoose'); done_testing; MooseX-NonMoose-0.26/MANIFEST0000644000175000001440000000160012303222371014241 0ustar doyusers# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.008. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/MooseX/NonMoose.pm lib/MooseX/NonMoose/InsideOut.pm lib/MooseX/NonMoose/Meta/Role/Class.pm lib/MooseX/NonMoose/Meta/Role/Constructor.pm t/00-compile.t t/BUILD.t t/BUILDARGS.t t/FOREIGNBUILDARGS.t t/attrs.t t/basic.t t/buggy-constructor-inlining.t t/buggy-constructors.t t/constructor-method-calls.t t/constructor-name.t t/destructor.t t/disable.t t/extends-moose-object.t t/extends-version.t t/hashref-constructor.t t/immutable.t t/methods.t t/moose-exporter.t t/moose.t t/moosex-globref.t t/moosex-insideout.t t/multi-level.t t/no-new-constructor-error.t t/nonmoose-moose-nonmoose.t t/only-metaclass-trait.t t/reinitialize.t t/replaced-constructor.t xt/release/eol.t xt/release/no-tabs.t xt/release/pod-coverage.t xt/release/pod-syntax.t MooseX-NonMoose-0.26/META.yml0000644000175000001440000001623712303222371014375 0ustar doyusers--- abstract: 'easy subclassing of non-Moose classes' author: - 'Jesse Luehrs ' build_requires: File::Spec: 0 IO::Handle: 0 IPC::Open3: 0 Moose: 0 Test::Fatal: 0 Test::Moose: 0 Test::More: 0.88 base: 0 strict: 0 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.008, CPAN::Meta::Converter version 2.132830' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: MooseX-NonMoose provides: MooseX::NonMoose: file: lib/MooseX/NonMoose.pm version: 0.26 MooseX::NonMoose::InsideOut: file: lib/MooseX/NonMoose/InsideOut.pm version: 0.26 MooseX::NonMoose::Meta::Role::Class: file: lib/MooseX/NonMoose/Meta/Role/Class.pm version: 0.26 MooseX::NonMoose::Meta::Role::Constructor: file: lib/MooseX/NonMoose/Meta/Role/Constructor.pm version: 0.26 requires: List::MoreUtils: 0 Module::Runtime: 0 Moose::Exporter: 0 Moose::Role: 2.0000 Moose::Util: 0 Try::Tiny: 0 warnings: 0 resources: bugtracker: https://github.com/doy/moosex-nonmoose/issues homepage: http://metacpan.org/release/MooseX-NonMoose repository: git://github.com/doy/moosex-nonmoose.git version: 0.26 x_Dist_Zilla: perl: version: 5.018001 plugins: - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@DOY/TestMoreDoneTesting' version: 5.008 - class: Dist::Zilla::Plugin::GatherDir name: '@DOY/GatherDir' version: 5.008 - class: Dist::Zilla::Plugin::PruneCruft name: '@DOY/PruneCruft' version: 5.008 - class: Dist::Zilla::Plugin::ManifestSkip name: '@DOY/ManifestSkip' version: 5.008 - class: Dist::Zilla::Plugin::MetaYAML name: '@DOY/MetaYAML' version: 5.008 - class: Dist::Zilla::Plugin::License name: '@DOY/License' version: 5.008 - class: Dist::Zilla::Plugin::Readme name: '@DOY/Readme' version: 5.008 - class: Dist::Zilla::Plugin::RunExtraTests name: '@DOY/RunExtraTests' version: 0.013 - class: Dist::Zilla::Plugin::ExecDir name: '@DOY/ExecDir' version: 5.008 - class: Dist::Zilla::Plugin::ShareDir name: '@DOY/ShareDir' version: 5.008 - class: Dist::Zilla::Plugin::MakeMaker name: '@DOY/MakeMaker' version: 5.008 - class: Dist::Zilla::Plugin::Manifest name: '@DOY/Manifest' version: 5.008 - class: Dist::Zilla::Plugin::TestRelease name: '@DOY/TestRelease' version: 5.008 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@DOY/ConfirmRelease' version: 5.008 - class: Dist::Zilla::Plugin::MetaConfig name: '@DOY/MetaConfig' version: 5.008 - class: Dist::Zilla::Plugin::MetaJSON name: '@DOY/MetaJSON' version: 5.008 - class: Dist::Zilla::Plugin::NextRelease name: '@DOY/NextRelease' version: 5.008 - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@DOY/CheckChangesHasContent' version: 0.006 - class: Dist::Zilla::Plugin::PkgVersion name: '@DOY/PkgVersion' version: 5.008 - class: Dist::Zilla::Plugin::Authority name: '@DOY/Authority' version: 1.006 - class: Dist::Zilla::Plugin::PodCoverageTests name: '@DOY/PodCoverageTests' version: 5.008 - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@DOY/PodSyntaxTests' version: 5.008 - class: Dist::Zilla::Plugin::NoTabsTests config: Dist::Zilla::Plugin::Test::NoTabs: module_finder: - ':InstallModules' script_finder: - ':ExecFiles' name: '@DOY/NoTabsTests' version: 0.05 - class: Dist::Zilla::Plugin::EOLTests name: '@DOY/EOLTests' version: 0.02 - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: filename: t/00-compile.t module_finder: - ':InstallModules' script_finder: - ':ExecFiles' name: '@DOY/Test::Compile' version: 2.037 - class: Dist::Zilla::Plugin::Metadata name: '@DOY/Metadata' version: 3.03 - class: Dist::Zilla::Plugin::MetaResources name: '@DOY/MetaResources' version: 5.008 - class: Dist::Zilla::Plugin::Git::Check name: '@DOY/Git::Check' version: 2.016 - class: Dist::Zilla::Plugin::Git::Commit name: '@DOY/Git::Commit' version: 2.016 - class: Dist::Zilla::Plugin::Git::Tag name: '@DOY/Git::Tag' version: 2.016 - class: Dist::Zilla::Plugin::Git::NextVersion name: '@DOY/Git::NextVersion' version: 2.016 - class: Dist::Zilla::Plugin::ContributorsFromGit name: '@DOY/ContributorsFromGit' version: 0.006 - class: Dist::Zilla::Plugin::FinderCode name: '@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: 5.008 - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: {} Dist::Zilla::Role::MetaProvider::Provider: inherit_missing: 1 inherit_version: 1 meta_noindex: 1 name: '@DOY/MetaProvides::Package' version: 1.15000000 - class: Dist::Zilla::Plugin::PodWeaver name: '@DOY/PodWeaver' version: 3.101641 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@DOY/UploadToCPAN' version: 5.008 - class: Dist::Zilla::Plugin::AutoPrereqs name: AutoPrereqs version: 5.008 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: DevelopRequires version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: 5.008 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 5.008 x_authority: cpan:DOY x_contributors: - 'Brian Phillips ' - 'Dave Rolsky ' - 'Florian Ragwitz ' - 'Gareth Harper ' - 'Hans Dieter Pearcey ' - 'Jason May ' - 'Karen Etheridge ' - 'fschlich ' MooseX-NonMoose-0.26/dist.ini0000644000175000001440000000053112303222371014556 0ustar doyusersname = MooseX-NonMoose author = Jesse Luehrs license = Perl_5 copyright_holder = Jesse Luehrs [@DOY] :version = 0.14 dist = MooseX-NonMoose repository = github [AutoPrereqs] skip = ^BadFoo\d?\b skip = ^Foo\b skip = ^Bar\b skip = ^NonMoose$ skip = ^IO:: [Prereqs / DevelopRequires] MooseX::GlobRef = 0 MooseX::InsideOut = 0 MooseX-NonMoose-0.26/LICENSE0000644000175000001440000004365312303222371014133 0ustar doyusersThis software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Jesse Luehrs. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Jesse Luehrs. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End MooseX-NonMoose-0.26/Changes0000644000175000001440000000735212303222371014415 0ustar doyusersRevision history for MooseX-NonMoose 0.26 2014-02-25 - fix dependency specification for Try::Tiny (Gareth Harper, #9) 0.25 2014-02-06 - fix for Module::Runtime 0.014 0.24 2013-09-07 - added missing lib include (Karen Etheridge) 0.23 2013-09-04 - stop using old and deprecated (or soon to be deprecated) functions from Class::MOP 0.22 2011-05-09 - Fix issues where the metaclass gets reinitialized after the call to 'extends' but before 'make_immutable'. This could happen if a role used an extension which provided an application_to_class metarole, since the role application would then apply a metarole to the class, and metarole application currently causes metaclass reinitialization in Moose. (ugh.) 0.21 2011-04-29 - Allow this module to work with constructors with names other than 'new'. If you're extending a class with a constructor named something other than 'new', you should declare this when calling extends, as in: extends 'Foo' => { -constructor_name => 'create' }; This will ensure that calling 'create' will also call Moose's constructor. 0.20 2011-03-22 - fix warning when passing inline_constructor => 0 with no superclass new method (rafl). 0.19 2011-03-02 - don't die if superclass doesn't have a 'new' method 0.18 2011-02-09 - forward compat for Moose 2.0 0.17 2010-11-08 - convert to Test::Fatal, and dep on it 0.16 2010-10-05 - Make it work with Moose 1.15 (Dave Rolsky). 0.15 2010-08-20 - Fix the fallback constructor call for hashref parameters (ribasushi, t0m, castaway). 0.14 2010-07-19 - Avoid warnings from Moose 1.09, part 2 (Dave Rolsky). 0.13 2010-07-18 - Also avoid warnings in MooseX::NonMoose::InsideOut. 0.12 2010-07-18 - Avoid warnings from Moose 1.09 (Dave Rolsky). 0.11 2010-06-30 - Actually use the right test. 0.10 2010-06-30 - Don't break if someone specifies a version to extends. 0.09 2010-06-15 - Fix several issues relating to picking the correct constructor to call from the constructor that we build. 0.08 2010-05-20 - Fix inheriting from classes which don't bless their instances into the correct class when subclassing (jhallock). - Update for things fixed in latest Moose. 0.07 2009-09-27 - Start adding support for non-Moose destructors. Destructor inlining isn't supported yet, since Moose isn't quite flexible enough there for it to be more than an annoying hack, but this should still work with immutable classes anyway. 0.06 2009-09-27 - defining a custom constructor in a class using mx-nonmoose now works - use a less broken test for whether or not a superclass has an inlined constructor (fixes issue uncovered by fixes to Moose's metaclass compatibility fixing) 0.05 2009-06-24 - gaaaaah, packaging is so stupid (remove stray test.pl file) 0.04 2009-06-23 - Add tests and official support for alternate instance metaclasses, such as MooseX::GlobRef and MooseX::InsideOut - including supplying a custom exporter MooseX::NonMoose::InsideOut which should work in all possible cases, when just using the same hash that the nonmoose class is using would break - Fix a couple issues with inheriting from MooseX::NonMoose classes - make sure FOREIGNBUILDARGS is only called once, and fix some issues with immutability 0.03 2009-05-06 - Add a FOREIGNBUILDARGS method to support modifying the argument list passed to the non-Moose constructor 0.02 2009-04-29 - A few minor doc fixes 0.01 2009-04-20 - Initial release MooseX-NonMoose-0.26/README0000644000175000001440000000057012303222371013775 0ustar doyusers This archive contains the distribution MooseX-NonMoose, version 0.26: easy subclassing of non-Moose classes This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v5.008.