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!
# This file documents the revision history for Perl extension Catalyst.
+ Bug fixes:
+ - Add '1;' to all classes which were relying on the ->make_immutable
+ call to return a true value. Due to perl internals bugs in 5.8 and
+ 5.10 (not present in other perl versions) require can pass the
+ context inappropriately, meaning that some methods of loading classes
+ can fail due to void context being passed throuh to make_immutable,
+ causing it to not return a value.
+ This bug is shown by trying to load Catalyst::Script::Create (for example)
+ with Module::Require and is fixed in core by commit 021f53de09926
+
5.90005 - 2011-10-22 13:35:00
New features:
}
__PACKAGE__->meta->make_immutable;
+1;
=head1 USAGE
with 'Catalyst::ScriptRole';
__PACKAGE__->meta->make_immutable;
+1;
=head1 NAME
}
__PACKAGE__->meta->make_immutable;
+1;
=head1 NAME
}
__PACKAGE__->meta->make_immutable;
+1;
=head1 NAME
}
__PACKAGE__->meta->make_immutable;
-
1;
=head1 NAME
__PACKAGE__->meta->make_immutable;
+1;
=head1 NAME
}
__PACKAGE__->meta->make_immutable;
+1;
=head1 NAME