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.