Patch: s/die/croak/ in Moose.pm to improve error reporting

[email protected] (Tod Hagan)
Newsgroups perl.moose
Message-ID <[email protected]>
Hi all,

Attached is just a minor patch to improve the reporting of errors when
using Moose.

Tod

-- 
Tod Hagan
Information Technologist
AIRMAP/Climate Change Research Center
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
Durham, NH 03824
Phone: 603-862-3116
Moose.pm_usage_croak.patch (text/x-patch, 809 B)
--- Moose.pm.orig	2008-04-03 18:13:34.000000000 -0400
+++ Moose.pm	2008-04-03 18:18:48.000000000 -0400
@@ -8,7 +8,7 @@
 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 @@
             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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.