--- /dev/null
+#!/usr/bin/env perl
+# originally mouse_bad.pl, reported by chocolateboy (RT #54203)
+
+use constant HAS_PATH_CLASS => eval{ require Path::Class };
+use Test::More HAS_PATH_CLASS ? (tests => 4) : (skip_all => 'Testing with Path::Class');
+
+package MyClass;
+
+use Mouse;
+use Path::Class qw(file);
+
+has path => (
+ is => 'rw',
+ isa => 'Str',
+);
+
+sub BUILD {
+ my $self = shift;
+ my $path1 = file($0)->stringify;
+ ::ok(defined $path1, 'file($0)->stringify');
+
+ $self->path(file($0)->stringify);
+ my $path2 = $self->path();
+ ::ok(defined $path2, '$self->path(file($0)->stringify)');
+
+ my $path3 = $self->path(file($0)->stringify);
+ ::ok(defined $path3, 'my $path3 = $self->path(file($0)->stringify)');
+}
+
+package main;
+
+my $object = MyClass->new();
+ok defined($object->path);
if(flags & MOUSEf_ATTR_HAS_TC){
value = mouse_xa_apply_type_constraint(aTHX_ xa, value, flags);
}
- set_slot(object, slot, value);
+ value = set_slot(object, slot, value);
if(SvROK(value) && flags & MOUSEf_ATTR_IS_WEAK_REF){
weaken_slot(object, slot);
}
}
if(MOUSE_xc_flags(xc) & MOUSEf_XC_IS_ANON){
- set_slot(object, newSVpvs_flags("__METACLASS__", SVs_TEMP), meta);
+ (void)set_slot(object, newSVpvs_flags("__METACLASS__", SVs_TEMP), meta);
}
}
}
sv_setsv_mg((SV*)gv, code_ref); /* *gv = $code_ref */
- set_slot(methods, name, code); /* $self->{methods}{$name} = $code */
+ (void)set_slot(methods, name, code); /* $self->{methods}{$name} = $code */
/* name the CODE ref if it's anonymous */
{
value = mouse_xa_apply_type_constraint(aTHX_ MOUSE_mg_xa(mg), value, flags);
}
- set_slot(self, slot, value);
+ value = set_slot(self, slot, value);
if(flags & MOUSEf_ATTR_IS_WEAK_REF){
weaken_slot(self, slot);
else{
check = newRV_inc((SV*)mouse_tc_generate(aTHX_ NULL, (check_fptr_t)mouse_types_check, (SV*)checks));
}
- set_slots(self, "compiled_type_constraint", check);
+ (void)set_slots(self, "compiled_type_constraint", check);
}