use Try::Tiny;
use overload ();
-our $VERSION = '1.08';
+our $VERSION = '1.14';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Deprecated;
# method-generating options shouldn't be overridden
sub illegal_options_for_inheritance {
- qw(is reader writer accessor clearer predicate)
+ qw(reader writer accessor clearer predicate)
}
# NOTE/TODO
return;
}
+sub inline_set {
+ my $self = shift;
+ my ( $instance, $value ) = @_;
+
+ my $mi = $self->associated_class->get_meta_instance;
+
+ my $code
+ = $mi->inline_set_slot_value( $instance, $self->slots, $value ) . ";";
+ $code
+ .= $mi->inline_weaken_slot_value( $instance, $self->slots, $value )
+ . ";"
+ if $self->is_weak_ref;
+
+ return $code;
+}
+
sub install_delegation {
my $self = shift;
=item * coerce => $bool
This option is only valid for objects with a type constraint
-(C<isa>). If this is true, then coercions will be applied whenever
+(C<isa>) that defined a coercion. If this is true, then coercions will be applied whenever
this attribute is set.
You can make both this and the C<weak_ref> option true.
This method overrides the parent to also remove delegation methods.
+=item B<< $attr->inline_set($instance_var, $value_var) >>
+
+This method return a code snippet suitable for inlining the relevant
+operation. It expect strings containing variable names to be used in the
+inlining, like C<'$self'> or C<'$_[1]'>.
+
=item B<< $attr->install_delegation >>
This method adds its delegation methods to the attribute's associated