Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 57275
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: roman.hubacek [...] centrum.cz
Cc:
AdminCc:

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



Subject: Error message from inside of module when used property w/Array trait
Date: Fri, 07 May 2010 11:04:19 +0200
To: <bug-Moose [...] rt.cpan.org>
From: <roman.hubacek [...] centrum.cz>
When a class is using property with Array native trait, errors are reported from within a Moose::Meta::Attribute::Native::MethodProvider::Array module. Short example: ------------------------------------ package Cls; use Moose; has an_array => ( traits => ['Array'], isa => 'ArrayRef[Str]', is => 'rw', # !!! forgotten default to empty array handles => { add_item => 'push', }, ); package main; my $c = Cls->new(); $c->add_item('String'); ------------------------------------ The code yields this error message: Can't use an undefined value as an ARRAY reference at d:/Prog/Perl/site/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm line 130. Preferrably this could error at line with $c->add_item('String'). I am using Moose 1.02 with ActivePerl 5.10.0 on WinXP. -- thanks a lot. Roman
This no longer throws an error. This might seem weird, but that's how Perl itself works ... perl -WE 'my $x = {}; push @{ $x->{foo} }, 42' doesn't warn either. Go figure.