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.
our $AUTHORITY = 'cpan:STEVAN';
use Scalar::Util 'blessed';
-use Carp 'confess', 'croak', 'cluck';
+use Carp 'confess';
use Moose::Exporter;
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')
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;