=head3 Is Moose "production ready"?
-Yes. I have two medium-to-large-ish web applications in
+Yes. I have three medium-to-large-ish web applications in
production using Moose, they have been running without
issue now for almost a year.
=head3 When will Moose 1.0 be ready?
-I had originally said it would be end of 2006, but various bits
-of $work kept me too busy. At this point, I think we are getting
-pretty close and I will likely declare 1.0 within the next few
-releases.
+It is right now, I just haven't bumped the version number up yet.
-When will that be? Hard to say really, but honestly, it is ready
-to use now, the difference between now and 1.0 will be pretty
-minimal.
+I still have some more internal TODO items I would like to complete
+before I would even consider bumping it to 1.0.
=head2 Constructors
use B 'svref_2object';
use Sub::Exporter;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
our $AUTHORITY = 'cpan:STEVAN';
## --------------------------------------------------------
use re "eval";
- my $valid_chars = qr{[\w:|]};
+ my $valid_chars = qr{[\w:]};
my $type_atom = qr{ $valid_chars+ };
my $type = qr{ $valid_chars+ (?: \[ (??{$any}) \] )? }x;
my $type_capture_parts = qr{ ($valid_chars+) (?: \[ ((??{$any})) \] )? }x;
my $type_with_parameter = qr{ $valid_chars+ \[ (??{$any}) \] }x;
- my $op_union = qr{ \s+ \| \s+ }x;
+ my $op_union = qr{ \s* \| \s* }x;
my $union = qr{ $type (?: $op_union $type )+ }x;
our $any = qr{ $type | $union }x;
# Array of Ints or Strings
-my $array_of_ints_or_strings = Moose::Util::TypeConstraints::create_parameterized_type_constraint('ArrayRef[Int | Str]');
+my $array_of_ints_or_strings = Moose::Util::TypeConstraints::create_parameterized_type_constraint('ArrayRef[Int|Str]');
isa_ok($array_of_ints_or_strings, 'Moose::Meta::TypeConstraint::Parameterized');
ok($array_of_ints_or_strings->check([ 1, 'two', 3 ]), '... this passed the type check');
# we can't build this using the simplistic parser
# we have, so we have to do it by hand - SL
-my $pure_insanity = Moose::Util::TypeConstraints::create_type_constraint_union('ArrayRef[Int | Str] | ArrayRef[Int | HashRef]');
+my $pure_insanity = Moose::Util::TypeConstraints::create_type_constraint_union('ArrayRef[Int|Str] | ArrayRef[Int | HashRef]');
isa_ok($pure_insanity, 'Moose::Meta::TypeConstraint::Union');
ok($pure_insanity->check([ 1, {}, 3 ]), '... this passed the type check');
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More tests => 41;
BEGIN {
use_ok("Moose::Util::TypeConstraints");
}
+=pod
+
+This is a good canidate for LectroTest
+Volunteers welcome :)
+
+=cut
+
## check the containers
ok(Moose::Util::TypeConstraints::_detect_parameterized_type_constraint($_),
'ArrayRef[Foo | Int]',
'ArrayRef[ArrayRef[Int]]',
'ArrayRef[ArrayRef[Int | Foo]]',
+ 'ArrayRef[ArrayRef[Int|Str]]',
);
ok(!Moose::Util::TypeConstraints::_detect_parameterized_type_constraint($_),
my %split_tests = (
'ArrayRef[Foo]' => [ 'ArrayRef', 'Foo' ],
'ArrayRef[Foo | Int]' => [ 'ArrayRef', 'Foo | Int' ],
+ 'ArrayRef[Foo|Int]' => [ 'ArrayRef', 'Foo|Int' ],
# these will get processed with recusion,
# so we only need to detect it once
'ArrayRef[ArrayRef[Int]]' => [ 'ArrayRef', 'ArrayRef[Int]' ],
'ArrayRef[ArrayRef[Int | Foo]]' => [ 'ArrayRef', 'ArrayRef[Int | Foo]' ],
+ 'ArrayRef[ArrayRef[Int|Str]]' => [ 'ArrayRef', 'ArrayRef[Int|Str]' ],
);
is_deeply(
'... this correctly detected union (' . $_ . ')')
for (
'Int | Str',
+ 'Int|Str',
'ArrayRef[Foo] | Int',
+ 'ArrayRef[Foo]|Int',
'Int | ArrayRef[Foo]',
+ 'Int|ArrayRef[Foo]',
'ArrayRef[Foo | Int] | Str',
+ 'ArrayRef[Foo|Int]|Str',
'Str | ArrayRef[Foo | Int]',
+ 'Str|ArrayRef[Foo|Int]',
'Some|Silly|Name|With|Pipes | Int',
+ 'Some|Silly|Name|With|Pipes|Int',
);
ok(!Moose::Util::TypeConstraints::_detect_type_constraint_union($_),
for (
'Int',
'ArrayRef[Foo | Int]',
- 'Some|Silly|Name|With|Pipes',
+ 'ArrayRef[Foo|Int]',
);
{
my %split_tests = (
'Int | Str' => [ 'Int', 'Str' ],
+ 'Int|Str' => [ 'Int', 'Str' ],
'ArrayRef[Foo] | Int' => [ 'ArrayRef[Foo]', 'Int' ],
+ 'ArrayRef[Foo]|Int' => [ 'ArrayRef[Foo]', 'Int' ],
'Int | ArrayRef[Foo]' => [ 'Int', 'ArrayRef[Foo]' ],
+ 'Int|ArrayRef[Foo]' => [ 'Int', 'ArrayRef[Foo]' ],
'ArrayRef[Foo | Int] | Str' => [ 'ArrayRef[Foo | Int]', 'Str' ],
+ 'ArrayRef[Foo|Int]|Str' => [ 'ArrayRef[Foo|Int]', 'Str' ],
'Str | ArrayRef[Foo | Int]' => [ 'Str', 'ArrayRef[Foo | Int]' ],
- 'Some|Silly|Name|With|Pipes | Int' => [ 'Some|Silly|Name|With|Pipes', 'Int' ],
+ 'Str|ArrayRef[Foo|Int]' => [ 'Str', 'ArrayRef[Foo|Int]' ],
+ 'Some|Silly|Name|With|Pipes | Int' => [ 'Some', 'Silly', 'Name', 'With', 'Pipes', 'Int' ],
+ 'Some|Silly|Name|With|Pipes|Int' => [ 'Some', 'Silly', 'Name', 'With', 'Pipes', 'Int' ],
);
is_deeply(