From: Stevan Little Date: Thu, 3 Apr 2008 22:39:24 +0000 (+0000) Subject: s/die/croak/ X-Git-Tag: 0_55~246 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=547dda77201ee580b3dfda83b95e278ce6232182;p=gitmo%2FMoose.git s/die/croak/ --- diff --git a/Changes b/Changes index 1d001b2..2459cf1 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ Revision history for Perl extension Moose 0.41 ~~ numerous documentation updates ~~ + + - Changed all usage of die to Carp::croak for better + error reporting (initial patch by Tod Hagan) ** IMPORTANT NOTE ** - the make_immutable keyword is now deprecated, don't @@ -19,6 +22,10 @@ Revision history for Perl extension Moose - inherited attributes may now be extended without restriction on the type ('isa') (Sartak) - added tests for this (Sartak) + - when an attribute property is malformed (such as lazy without + a default), give the name of the attribute in the error + message (Sartak) + 0.40 Fri. March 14, 2008 - I hate Pod::Coverage diff --git a/lib/Moose.pm b/lib/Moose.pm index 2f415d1..c172f29 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -8,7 +8,7 @@ our $VERSION = '0.41'; our $AUTHORITY = 'cpan:STEVAN'; use Scalar::Util 'blessed', 'reftype'; -use Carp 'confess'; +use Carp 'confess', 'croak'; use Sub::Name 'subname'; use Sub::Exporter; @@ -105,7 +105,7 @@ use Moose::Util (); my $class = $CALLER; return subname 'Moose::has' => sub ($;%) { my $name = shift; - die '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) ]; $class->meta->add_attribute( $_, %options ) for @$attrs; diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index a34ef1d..3daf355 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -316,7 +316,7 @@ sub _fix_metaclass_incompatability { # Moose::Util::apply_all_roles # instead sub _apply_all_roles { - die 'DEPRECATED: use Moose::Util::apply_all_roles($meta, @roles) instead' + Carp::croak 'DEPRECATED: use Moose::Util::apply_all_roles($meta, @roles) instead' } sub _process_attribute { diff --git a/lib/Moose/Meta/Role/Application.pm b/lib/Moose/Meta/Role/Application.pm index 4dce63c..99cc38f 100644 --- a/lib/Moose/Meta/Role/Application.pm +++ b/lib/Moose/Meta/Role/Application.pm @@ -68,14 +68,14 @@ sub apply { $self->apply_after_method_modifiers(@_); } -sub check_role_exclusions { die "Abstract Method" } -sub check_required_methods { die "Abstract Method" } -sub check_required_attributes { die "Abstract Method" } - -sub apply_attributes { die "Abstract Method" } -sub apply_methods { die "Abstract Method" } -sub apply_override_method_modifiers { die "Abstract Method" } -sub apply_method_modifiers { die "Abstract Method" } +sub check_role_exclusions { Carp::croak "Abstract Method" } +sub check_required_methods { Carp::croak "Abstract Method" } +sub check_required_attributes { Carp::croak "Abstract Method" } + +sub apply_attributes { Carp::croak "Abstract Method" } +sub apply_methods { Carp::croak "Abstract Method" } +sub apply_override_method_modifiers { Carp::croak "Abstract Method" } +sub apply_method_modifiers { Carp::croak "Abstract Method" } sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) } sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) } diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index 53ba3a7..4592a63 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -187,7 +187,7 @@ sub _collect_all_parents { ## this should get deprecated actually ... -sub union { die "DEPRECATED" } +sub union { Carp::croak "DEPRECATED" } 1;