Resolve RT #56837 (reported by Sanko Robinson), based on his patch
[gitmo/Mouse.git] / t / 900_bug / 004_RT54203.t
CommitLineData
ca8e67d6 1#!/usr/bin/env perl
2# originally mouse_bad.pl, reported by chocolateboy (RT #54203)
3
4use constant HAS_PATH_CLASS => eval{ require Path::Class };
5use Test::More HAS_PATH_CLASS ? (tests => 4) : (skip_all => 'Testing with Path::Class');
6
7package MyClass;
8
9use Mouse;
10use Path::Class qw(file);
11
12has path => (
13 is => 'rw',
14 isa => 'Str',
15);
16
17sub BUILD {
18 my $self = shift;
19 my $path1 = file($0)->stringify;
20 ::ok(defined $path1, 'file($0)->stringify');
21
22 $self->path(file($0)->stringify);
23 my $path2 = $self->path();
24 ::ok(defined $path2, '$self->path(file($0)->stringify)');
25
26 my $path3 = $self->path(file($0)->stringify);
27 ::ok(defined $path3, 'my $path3 = $self->path(file($0)->stringify)');
28}
29
30package main;
31
32my $object = MyClass->new();
33ok defined($object->path);