something that can be assigned to). This should fix issues with
KiokuDB::Class. (doy)
+ * The deprecated "default is" warning no longer happens is the attribute has
+ any accessor method defined (accessor, reader, writer).
+
+ * The "default default" code for some native delegations no longer issues a
+ deprecation warning when the attribute is required or has a builder.
+
+ * Setting a "default default" caused a fatal error if you defined a builder
+ for the attribute.
+
1.15 Tue, Oct 5, 2010
[API CHANGES]
requires 'Class::MOP' => '1.10';
requires 'Data::OptList' => '0';
requires 'List::MoreUtils' => '0.12';
-requires 'Package::DeprecationManager' => '0.04';
+requires 'Package::DeprecationManager' => '0.07';
requires 'Params::Util' => '1.00';
requires 'Scalar::Util' => '1.19';
requires 'Sub::Exporter' => '0.980';
'type without sugar' => '0.72',
'Moose::init_meta' => '0.56',
},
- -ignore => [
- qw( Moose
- Moose::Exporter
- Moose::Meta::Attribute
- Moose::Meta::Class
- Moose::Util::MetaRole
- )
- ],
+ -ignore => [qr/^(?:Class::MOP|Moose)(?:::)?/],
;
1;
package Moose::Meta::Attribute::Native::Trait;
use Moose::Role;
+
+use List::MoreUtils qw( any );
use Moose::Util::TypeConstraints;
use Moose::Deprecated;
$self->_check_helper_type( $options, $name );
- if ( !exists $options->{is} && $self->can('_default_is') ) {
+ if ( !( any { exists $options->{$_} } qw( is reader writer accessor ) )
+ && $self->can('_default_is') ) {
+
$options->{is} = $self->_default_is;
Moose::Deprecated::deprecated(
);
}
- if ( !exists $options->{default} && $self->can('_default_default') ) {
+ if (
+ !(
+ $options->{required}
+ || any { exists $options->{$_} } qw( default builder )
+ )
+ && $self->can('_default_default')
+ ) {
+
$options->{default} = $self->_default_default;
Moose::Deprecated::deprecated(
);
}
+{
+ package Pack1;
+
+ use Moose;
+
+ ::stderr_is{ has foo => (
+ traits => ['String'],
+ reader => '_foo',
+ isa => 'Str',
+ default => q{},
+ );
+ } q{},
+ 'Providing a reader for a String trait avoids default is warning';
+
+ ::stderr_is{ has bar => (
+ traits => ['String'],
+ is => 'ro',
+ isa => 'Str',
+ builder => '_build_foo',
+ );
+ } q{},
+ 'Providing a builder for a String trait avoids default default warning';
+
+ sub _build_foo { }
+}
+
+{
+ package Pack2;
+
+ use Moose;
+
+ ::stderr_is{ has foo => (
+ traits => ['String'],
+ writer => '_foo',
+ isa => 'Str',
+ default => q{},
+ );
+ } q{},
+ 'Providing a writer for a String trait avoids default is warning';
+
+ ::stderr_is{ has bar => (
+ traits => ['String'],
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+ );
+ } q{},
+ 'Making a String trait required avoids default default warning';
+
+ sub _build_foo { }
+}
+
+{
+ package Pack3;
+
+ use Moose;
+
+ ::stderr_is{ has foo => (
+ traits => ['String'],
+ accessor => '_foo',
+ isa => 'Str',
+ default => q{},
+ );
+ } q{},
+ 'Providing an accessor for a String trait avoids default is warning';
+}
+
done_testing;