Bug fix for require dieing as make_immutable doesn't return true.
authorTomas Doran <bobtfish@bobtfish.net>
Mon, 24 Oct 2011 20:12:53 +0000 (13:12 -0700)
committerTomas Doran <bobtfish@bobtfish.net>
Mon, 24 Oct 2011 21:50:40 +0000 (14:50 -0700)
commitf4de8c998c61fd442cb9590a3c052cf41b4c0d67
treed579a9cfe840ebfc5d4b2499fd4860b7a2a265ae
parentb6722bdd672b42bbb8f70d77f5495f373b830b3c
Bug fix for require dieing as make_immutable doesn't return true.

This is due to a core bug in perl where void context gets passed through
to make_immutable, which means it returns nothing:

perl -e 'require Catalyst::Script::Create;' succeeds
perl -e 'sub foo { require Catalyst::Script::Create; } foo()' fails
perl -e 'sub foo { @a = require Catalyst::Script::Create; } foo()' succeeds
perl -e 'sub foo { $a = require Catalyst::Script::Create; } foo()' succeeds
perl -e 'sub foo { require Catalyst::Script::Create; 1 } foo()' succeeds
perl -e 'sub foo { require Catalyst::Script::Create } @x = foo()' succeeds
perl -e 'sub foo { require Catalyst::Script::Create } $x = foo()' succeeds

Perl versions affected: 5.8 and 5.10, others do not have this issue

commit 021f53de09926 by Gerard Goossen appears to be the core bugfix

The core bug was that that was being overridden by the special handling
for return expressions, and the fix is to prevent that overriding.
Rruntime correctness depends on GIMME_V being correct for the require op;
it's not forced inside pp_require

Zefram++ for digging into this and working out what's going on!
Changes
lib/Catalyst/DispatchType/Chained.pm
lib/Catalyst/Script/CGI.pm
lib/Catalyst/Script/Create.pm
lib/Catalyst/Script/FastCGI.pm
lib/Catalyst/Script/Server.pm
lib/Catalyst/Script/Test.pm
lib/Catalyst/ScriptRunner.pm