#!/usr/bin/env perl { package Normal::Moose::Class; use Moose; has 'name' => ( is => 'rw', default => __PACKAGE__, ); no Moose; 1; } { package Repeat::Attr::No; use MooseX::InsideOut; extends 'Normal::Moose::Class'; no MooseX::InsideOut; 1; } { package Repeat::Attr::Yes; use MooseX::InsideOut; extends 'Normal::Moose::Class'; has '+name' => ( default => __PACKAGE__, ); no MooseX::InsideOut; 1; } { package main; use 5.010_000; use strict; use warnings; use Test::More 'no_plan'; # Test a standard Moose class my $norm_moose = Normal::Moose::Class->new( name => 'normal-moose-class' ); is( $norm_moose->name, 'normal-moose-class', 'normal-moose-class has the correct name' ); # Test the sub class with unmodified attribute my $io_moose = Repeat::Attr::No->new( name => 'repeat-attr-no' ); is( $io_moose->name, undef, 'insideout subclass does not assign to attribute name on creation' ); $io_moose->name('repeat-attr-no'); is( $io_moose->name, 'repeat-attr-no', 'but will at any other time' ); # Test the sub class with modified attribute my $child = Repeat::Attr::Yes->new( name => 'repeat-attr-yes' ); is( $child->name, 'repeat-attr-yes', 'unless you modify the attribute in the class declaration' ); exit 0; } __END__ ok 1 - normal-moose-class has the correct name ok 2 - insideout subclass does not assign to attribute name on creation ok 3 - but will at any other time ok 4 - unless you modify the attribute in the class declaration 1..4