Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mouse CPAN distribution.

Report information
The Basics
Id: 54203
Status: resolved
Priority: 0/
Queue: Mouse

People
Owner: Nobody in particular
Requestors: CHOCOLATE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Strange interaction with Path::Class and/or overloading
Download (untitled) / with headers
text/plain 662b
perl 5.10.0 Mouse 0.48 Path::Class 0.18 Ubuntu 9.10 If I create a class with a string attribute e.g. has path => (is => 'rw', isa => 'Str'); - and combine getting and setting that attribute e.g. my $path = $self->path($0); - the setter returns undef (mouse_bad.pl) if the path is an explicitly stringified Path::Class::File: use Path::Class::File qw(file); my $path = $self->path(file($0)->stringify); Everything works as expected (mouse_good.pl) if the path is stringified implicitly: my $path = $self->path(file($0) . ''); I realise it could be a Path::Class issue, but I'm reporting it here to start with because the error doesn't occur in Moose :-)
Subject: mouse_good.pl
Download mouse_good.pl
text/x-perl 558b
#!/usr/bin/env perl package MyClass; use Mouse; use Path::Class qw(file); has path => ( is => 'rw', isa => 'Str', ); sub BUILD { my $self = shift; my $path1 = file($0) . ''; warn "path 1: $path1", $/; $self->path(file($0) . ''); my $path2 = $self->path(); warn "path 2: $path2", $/; my $path3 = $self->path(file($0) . ''); die 'ERROR: path not defined' unless (defined $path3); warn "path 3: $path3", $/; } package main; use feature qw(say); my $object = MyClass->new(); say 'path: ', $object->path();
Subject: mouse_bad.pl
Download mouse_bad.pl
text/x-perl 576b
#!/usr/bin/env perl 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; warn "path 1: $path1", $/; $self->path(file($0)->stringify); my $path2 = $self->path(); warn "path 2: $path2", $/; my $path3 = $self->path(file($0)->stringify); die 'ERROR: path not defined' unless (defined $path3); warn "path 3: $path3", $/; } package main; use feature qw(say); my $object = MyClass->new(); say 'path: ', $object->path();
Download (untitled) / with headers
text/plain 294b
Hi, chocolateboy. I have released Mouse 0.49, fixing the bug you reported. The problem is not in Path::Class, but in Mouse::XS. It's a subtle problem in refcount control and mortality. The commit is ca8e67d622c1a14bee4933ad64b1e465c5d63766. Thank you, -- Goro Fuji (gfx) GFUJI at CPAN.org


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.