Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 52982
Status: rejected
Priority: 0/
Queue: Moose

People
Owner: stevan.little [...] gmail.com
Requestors: RSAVAGE [...] cpan.org
Cc:
AdminCc:

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



Subject: Improve error msg when reserved word 'import' use as attribute
Download (untitled) / with headers
text/plain 811b
Hi Folks Moose is fabulous, but... :-) When I used: has import => (is => 'rw', isa => 'CGI::Office::Contacts::Import::vCards::View::vCards'); the usage of import trigged this obscure error msg: Can't use string ("CGI::Office::Contacts::Import::v") as a HASH ref while "strict refs" in use at accessor import defined at /home/ron/perl.modules/CGI-Office-Contacts-Import-vCards/lib/CGI/Office/Contacts/Import/vCards/View.pm line 20. The fact that the string in () was truncated to 32 chars really threw me off the track, compounded by the fact that I would normally never use import in it's intended manner and hence didn't twig to the confusion. Changing import to importer fixes the problem, but it took a couple of days to figure out. It'd be good if the word import itself trigger an error msg. TIA.
Download (untitled) / with headers
text/plain 1.8k
Actually this is not a Moose issue but a plain-old Perl issue. 'import' is a semi-reserved word in Perl and any subroutine named 'import' will get called automatically when you "use" the module. I suspect that somewhere in your code you have the following line: use CGI::Office::Contacts::Import::vCards::View; which is essentially the following code: BEGIN { require CGI::Office::Contacts::Import::vCards::View; CGI::Office::Contacts::Import::vCards::View->import(); } So while it would be nice if Moose had told you this, it has really nothing to do with Moose and the same issue would have occurred if you had be using Class::Accessor or any other method builder. As for the "truncated to 32 chars" issue, this error is one generated by Perl and not by Moose, so again, not a Moose issue but a Perl issue. Sorry this caused you such trouble, but I am afraid it was not Moose'ss fault. - Stevan On Tue Dec 22 17:46:04 2009, RSAVAGE wrote: Show quoted text
> Hi Folks > > Moose is fabulous, but... :-) > > When I used: > > has import => (is => 'rw', isa => > 'CGI::Office::Contacts::Import::vCards::View::vCards'); > > the usage of import trigged this obscure error msg: > > Can't use string ("CGI::Office::Contacts::Import::v") as a HASH ref > while "strict refs" in use at accessor import defined at > /home/ron/perl.modules/CGI-Office-Contacts-Import- > vCards/lib/CGI/Office/Contacts/Import/vCards/View.pm > line 20. > > The fact that the string in () was truncated to 32 chars really threw > me > off the track, compounded by the fact that I would normally never use > import in it's intended manner and hence didn't twig to the confusion. > > Changing import to importer fixes the problem, but it took a couple of > days to figure out. > > It'd be good if the word import itself trigger an error msg. > > TIA.
Subject: Re: [rt.cpan.org #52982] Improve error msg when reserved word 'import' use as attribute
Date: Wed, 23 Dec 2009 00:08:24 +0000
To: bug-Moose [...] rt.cpan.org
From: ron [...] savage.net.au
Download (untitled) / with headers
text/plain 226b
Hi Stevan Quoting "Stevan Little via RT" <bug-Moose@rt.cpan.org>: Show quoted text
> Sorry this caused you such trouble, but I am afraid it was not > Moose'ss fault. > > - Stevan
OK. Thanx for the quick reply. File as: Not a Moose) bug.


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.