From: Marcus Ramberg Date: Wed, 18 Jul 2007 11:45:07 +0000 (+0000) Subject: Better error handling X-Git-Tag: 5.7099_04~182 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=5e5bd6df0d40414ef887ac8b9aa67e2ffac77bd9 Better error handling --- diff --git a/Changes b/Changes index 2e8fb42..b5fa7fa 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ This file documents the revision history for Perl extension Catalyst. - Fix bug where a nested component would be setup twice + - Make ensure_class_loaded behave better with malformed class name 5.7008 - Fixed a bug where Content-Length could be set to 0 if a filehandle diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 9dc2c09..6c2ecb5 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -7,6 +7,7 @@ use HTTP::Request; use Path::Class; use URI; use Class::Inspector; +use Carp qw/croak/; =head1 NAME @@ -242,6 +243,9 @@ sub ensure_class_loaded { my $class = shift; my $opts = shift; + croak "Malformed class Name $class" + if $class =~ m/(?:\b\:\b|\:{3,})/; + return if !$opts->{ ignore_loaded } && Class::Inspector->loaded( $class ); # if a symbol entry exists we don't load again