[Moose-commits] r7597 - in Moose/trunk: . lib

sartak at code2.0beta.co.uk sartak at code2.0beta.co.uk
Tue Feb 10 01:38:43 GMT 2009


Author: sartak
Date: 2009-02-09 17:38:43 -0800 (Mon, 09 Feb 2009)
New Revision: 7597

Modified:
   Moose/trunk/Changes
   Moose/trunk/lib/Moose.pm
Log:
Make some keyword errors use throw_error instead of croak since Moose::Exporter wraps keywords now

Modified: Moose/trunk/Changes
===================================================================
--- Moose/trunk/Changes	2009-02-10 01:31:06 UTC (rev 7596)
+++ Moose/trunk/Changes	2009-02-10 01:38:43 UTC (rev 7597)
@@ -1,5 +1,9 @@
 Revision history for Perl extension Moose
 
+    * Moose
+      - Make some keyword errors use throw_error instead of croak
+        since Moose::Exporter wraps keywords now (Sartak)
+
 0.68 Wed, February 4, 2009
     * POD
       - Many spelling, typo, and formatting fixes by daxim.

Modified: Moose/trunk/lib/Moose.pm
===================================================================
--- Moose/trunk/lib/Moose.pm	2009-02-10 01:31:06 UTC (rev 7596)
+++ Moose/trunk/lib/Moose.pm	2009-02-10 01:38:43 UTC (rev 7597)
@@ -11,7 +11,7 @@
 our $AUTHORITY = 'cpan:STEVAN';
 
 use Scalar::Util 'blessed';
-use Carp         'confess', 'croak', 'cluck';
+use Carp         'confess';
 
 use Moose::Exporter;
 
@@ -52,12 +52,12 @@
 sub extends {
     my $class = shift;
 
-    croak "Must derive at least one class" unless @_;
+    Moose->throw_error("Must derive at least one class") unless @_;
 
     my @supers = @_;
     foreach my $super (@supers) {
         Class::MOP::load_class($super);
-        croak "You cannot inherit from a Moose Role ($super)"
+        Moose->throw_error("You cannot inherit from a Moose Role ($super)")
             if $super->can('meta')  && 
                blessed $super->meta &&
                $super->meta->isa('Moose::Meta::Role')
@@ -80,7 +80,10 @@
 sub has {
     my $class = shift;
     my $name  = shift;
-    croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1;
+
+    Moose->throw_error('Usage: has \'name\' => ( key => value, ... )')
+        if @_ == 1;
+
     my %options = ( definition_context => _caller_info(), @_ );
     my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
     Class::MOP::Class->initialize($class)->add_attribute( $_, %options ) for @$attrs;




More information about the Moose-commits mailing list