From: Stevan Little Date: Wed, 16 Aug 2006 19:33:39 +0000 (+0000) Subject: added default {} keyword X-Git-Tag: 0_12~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66bcefc11e804229e4c953ae9c17ae7c2d23b81b;p=gitmo%2FMoose.git added default {} keyword --- diff --git a/lib/Moose.pm b/lib/Moose.pm index 74af844..d7d4dbb 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -4,7 +4,7 @@ package Moose; use strict; use warnings; -our $VERSION = '0.12'; +our $VERSION = '0.13'; use Scalar::Util 'blessed', 'reftype'; use Carp 'confess'; @@ -45,7 +45,7 @@ use Moose::Util::TypeConstraints; # override a specific class $meta = $class->meta(); (blessed($meta) && $meta->isa('Moose::Meta::Class')) - || confess "Whoops, not møøsey enough"; + || confess "You already have a &meta function, but it does not return a Moose::Meta::Class"; } else { # NOTE: @@ -144,6 +144,12 @@ use Moose::Util::TypeConstraints; }, blessed => sub { return \&Scalar::Util::blessed; + }, + default => sub { + return subname 'Moose::default' => sub (&) { + my $block = shift; + return ('default' => $block); + }; } ); diff --git a/t/021_moose_w_metaclass.t b/t/021_moose_w_metaclass.t index 3bfabd1..dce160b 100644 --- a/t/021_moose_w_metaclass.t +++ b/t/021_moose_w_metaclass.t @@ -52,5 +52,7 @@ isa_ok(Foo->meta, 'Foo::Meta'); use metaclass 'Bar::Meta'; eval 'use Moose;'; ::ok($@, '... could not load moose without correct metaclass'); - ::like($@, qr/^Whoops\, not møøsey enough/, '... got the right error too'); + ::like($@, + qr/^You already have a \&meta function\, but it does not return a Moose\:\:Meta\:\:Class/, + '... got the right error too'); }