But if you load your MyPackage.pm module in a test.pl file containing:
use MyPackage ;
then it fails with:
Can't locate object method "new" via package "FOO::Soldier" at MyPackage.pm line 7.
Compilation failed in require at test2.pl line 3.
BEGIN failed--compilation aborted at test2.pl line 3.
One or more DATA sections were not processed by Inline.
I think this has to do with the eval'd INIT block in Inline.pm around line 200. I think
it runs at "run" time, while all the "use" stuff runs at compile time. So it's basically not run yet.
If you call:
just before creating the FOO::Solfier objects it will fix the problem.