Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 133407
Status: new
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

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



Subject: Inconsistent handling of Foo::Bar, ::Foo::Bar, and main::Foo::Bar
The following all basically work the same in Perl: my $obj = 'Foo::Bar'->new; my $obj = '::Foo::Bar'->new; my $obj = 'main::Foo::Bar'->new; Using any of those class names in $obj->isa works fine. Other bits, like $obj->DOES seem inconsistent with Moo. (But Moo does better than Moose!)
Subject: package-name-test-moo.t
use strict; use warnings; use Test::More; { package GGG; use Moo::Role; } { package Goose; use Moo; with 'GGG'; has 'goo' => ( is => 'ro' ); } my @roles = qw( GGG ::GGG main::GGG ); my @classes = qw( Goose ::Goose main::Goose ); foreach my $class ( @classes ) { subtest "\$class = '$class'" => sub { my $obj = $class->new( 'goo' => 42 ); is( $obj->goo, 42, '$obj->goo == 42' ); isa_ok( $obj, $_, '$obj' ) for @classes; ok( $obj->DOES($_), "\$obj\->DOES($_)" ) for @roles; ok( $obj->does($_), "\$obj\->does($_)" ) for @roles; }; } done_testing;