Skip Menu |

This queue is for tickets about the MooseX-Types CPAN distribution.

Report information
The Basics
Id: 47522
Status: resolved
Priority: 0/
Queue: MooseX-Types

People
Owner: Nobody in particular
Requestors: perl [...] evancarroll.com
Cc:
AdminCc:

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



Subject: compile time warnings with parameterized types.
package Class; use Moose; use MooseX::Types -declare => ['DMIDS']; use MooseX::Types::Moose qw(:all); subtype DMIDS , as 'ArrayRef[Int]'; coerce DMIDS , from Int , via { [$_] } , from Str , via { [split ',', $_] } ; yeilds error message WARNING: String found where Type expected (did you use a => instead of a , ?) at manyitems.t line 6 Can you get around it with the Parametized types?
Subject: Re: [rt.cpan.org #47522] compile time warnings with parameterized types.
Date: Fri, 3 Jul 2009 19:38:46 -0700
To: Evan Carroll via RT <bug-MooseX-Types [...] rt.cpan.org>
From: Rafael Kitover <rkitover [...] io.com>
On Thu, Jul 02, 2009 at 06:30:08PM -0400, Evan Carroll via RT wrote: ... Show quoted text
> subtype DMIDS , as 'ArrayRef[Int]';
... Show quoted text
> yeilds error message > > WARNING: String found where Type expected (did you use a => instead of a > , ?) at manyitems.t line 6 > > Can you get around it with the Parametized types?
Try: subtype DMIDS, as ArrayRef[Int]; # no quotes
It would be interesting to know //how// that works. I certainly didn't expect it to work at all like that. I thought MooseX::Types was just exporting subs. But, it seems as if its not use Class::MOP::Package; use XXX; my $p = Class::MOP::Package->initialize( 'Class' ); YYY grep /ArrayRef/, $p->list_all_package_symbols( 'CODE' ); Just returns this: --- is_ArrayRef --- ArrayRef ... I would have expected it to return all the parameterized types if that was the case?
On Mon Jul 06 11:19:55 2009, ECARROLL wrote: Show quoted text
> It would be interesting to know //how// that works. I certainly didn't > expect it to work at all like that. I thought MooseX::Types was just > exporting subs. But, it seems as if its not > > use Class::MOP::Package; > use XXX; > my $p = Class::MOP::Package->initialize( 'Class' ); > YYY grep /ArrayRef/, $p->list_all_package_symbols( 'CODE' ); > > Just returns this: > --- is_ArrayRef > --- ArrayRef > ... > > I would have expected it to return all the parameterized types if that > was the case?
Ignore this, I now see what's happening. Cool! ArrayRef[Int] Is actually ArrayRef([Int()])