# This file documents the revision history for Perl extension Catalyst.
+ - Fix loading of classes which do not define any symbols to not
+ die, as it didn't in 5.70 (t0m)
+ - Test for this (t0m)
- Bump MooseX::Emulate::Class::Accessor::Fast dependency
to force new version which fixes a lot of plugins (t0m)
- Make log levels additive, and add documentation and tests
http://code2.0beta.co.uk/moose/svnweb/index.cgi/moose/revision?rev=7036
(groditi)
+ - Fix 'as soon as Class::MOP 0.67 + 1 is released
+ Class::MOP::load_class($class) can be used instead' in Catalyst::Utils
+
- Common engine test failures, look into and get tests into core.
- Catalyst-Plugin-Authorization-ACL, Can't locate object method "tree"
croak "ensure_class_loaded should be given a classname, not a filename ($class)"
if $class =~ m/\.pm$/;
+ # $opts->{ignore_loaded} can be set to true, and this causes the class to be required, even
+ # if it already has symbol table entries. This is to support things like Schema::Loader, which
+ # part-generate classes in memory, but then also load some of their contents from disk.
return if !$opts->{ ignore_loaded }
&& Class::MOP::is_class_loaded($class); # if a symbol entry exists we don't load again
- # as soon as Class::MOP 0.67 + 1 is released Class::MOP::load_class($class) can be used instead
+ # FIXME - as soon as Class::MOP 0.67 + 1 is released Class::MOP::load_class($class) can be used instead
# this hack is so we don't overwrite $@ if the load did not generate an error
my $error;
die $error if $error;
- die "require $class was successful but the package is not defined"
+ warn "require $class was successful but the package is not defined."
unless Class::MOP::is_class_loaded($class);
return 1;
--- /dev/null
+package NullPackage;
+# Do nothing class, there should be no code or symbols defined here..
+# Loading this works fine in 5.70, but a die was introduced in 5.80 which caused
+# it to fail. This has been changed to a warning to maintain back-compat.
+# See Catalyst::Utils::ensure_class_loaded() for more info.
+1;
+
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 18;
use Class::MOP;
use lib "t/lib";
eval { Catalyst::Utils::ensure_class_loaded('Silly::File::Name.pm') };
like($@, qr/Malformed class Name/, 'errored sanely when given a classname ending in .pm');
+undef $@;
+$warnings = 0;
+Catalyst::Utils::ensure_class_loaded("NullPackage");
+is( $warnings, 1, 'Loading a package which defines no symbols warns');
+is( $@, undef, '$@ still undef' );
+