From: Todd Hepler Date: Wed, 21 May 2008 20:17:31 +0000 (+0000) Subject: standardize on using croak instead of confess in the sugar X-Git-Tag: 0_55~154 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc5e6b6f261067f8bcf68dee8644da21448df2c2;p=gitmo%2FMoose.git standardize on using croak instead of confess in the sugar --- diff --git a/lib/Moose.pm b/lib/Moose.pm index 072e628..c7ca1a8 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -79,7 +79,7 @@ use Moose::Util (); extends => sub { my $class = $CALLER; return Class::MOP::subname('Moose::extends' => sub (@) { - confess "Must derive at least one class" unless @_; + croak "Must derive at least one class" unless @_; my @supers = @_; foreach my $super (@supers) { diff --git a/lib/Moose/Role.pm b/lib/Moose/Role.pm index f916430..3a0774b 100644 --- a/lib/Moose/Role.pm +++ b/lib/Moose/Role.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Scalar::Util 'blessed'; -use Carp 'confess'; +use Carp 'confess', 'croak'; use Data::OptList; use Sub::Exporter; @@ -49,7 +49,7 @@ use Moose::Util::TypeConstraints; extends => sub { my $meta = _find_meta(); return Class::MOP::subname('Moose::Role::extends' => sub { - confess "Moose::Role does not currently support 'extends'" + croak "Moose::Role does not currently support 'extends'" }); }, with => sub { @@ -61,14 +61,14 @@ use Moose::Util::TypeConstraints; requires => sub { my $meta = _find_meta(); return Class::MOP::subname('Moose::Role::requires' => sub (@) { - confess "Must specify at least one method" unless @_; + croak "Must specify at least one method" unless @_; $meta->add_required_methods(@_); }); }, excludes => sub { my $meta = _find_meta(); return Class::MOP::subname('Moose::Role::excludes' => sub (@) { - confess "Must specify at least one role" unless @_; + croak "Must specify at least one role" unless @_; $meta->add_excluded_roles(@_); }); }, @@ -76,7 +76,7 @@ use Moose::Util::TypeConstraints; my $meta = _find_meta(); return Class::MOP::subname('Moose::Role::has' => sub ($;%) { my $name = shift; - confess 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1; + croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1; my %options = @_; my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; $meta->add_attribute( $_, %options ) for @$attrs; @@ -87,7 +87,7 @@ use Moose::Util::TypeConstraints; return Class::MOP::subname('Moose::Role::before' => sub (@&) { my $code = pop @_; do { - confess "Moose::Role do not currently support " + croak "Moose::Role do not currently support " . ref($_) . " references for before method modifiers" if ref $_; @@ -100,7 +100,7 @@ use Moose::Util::TypeConstraints; return Class::MOP::subname('Moose::Role::after' => sub (@&) { my $code = pop @_; do { - confess "Moose::Role do not currently support " + croak "Moose::Role do not currently support " . ref($_) . " references for after method modifiers" if ref $_; @@ -113,7 +113,7 @@ use Moose::Util::TypeConstraints; return Class::MOP::subname('Moose::Role::around' => sub (@&) { my $code = pop @_; do { - confess "Moose::Role do not currently support " + croak "Moose::Role do not currently support " . ref($_) . " references for around method modifiers" if ref $_; @@ -137,13 +137,13 @@ use Moose::Util::TypeConstraints; inner => sub { my $meta = _find_meta(); return Class::MOP::subname('Moose::Role::inner' => sub { - confess "Moose::Role cannot support 'inner'"; + croak "Moose::Role cannot support 'inner'"; }); }, augment => sub { my $meta = _find_meta(); return Class::MOP::subname('Moose::Role::augment' => sub { - confess "Moose::Role cannot support 'augment'"; + croak "Moose::Role cannot support 'augment'"; }); }, confess => sub {