http://www.perlmonks.org?node_id=1020270


in reply to Re^5: Exporter Problem
in thread Exporter Problem

Rob, 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:
Inline->init() ;
just before creating the FOO::Solfier objects it will fix the problem. Patrick

Replies are listed 'Best First'.
Re^7: Exporter Problem
by syphilis (Archbishop) on Feb 23, 2013 at 10:12 UTC
    Hi Patrick,
    Yes, I now recall this Inline->init(); trick having cropped up before - though I can't quite recall the context.

    I had the impression from earlier postings in this thread that, wrt Inline::Java, it wasn't necessary to load a MyPackage.pm to strike the problem. Instead it was enough to merely load the Inline::Java module into another namespace (as per my Inline::C demo).
    Perhaps that's not so - I don't currently have Inline::Java installed and therefore can't check that for myself.

    Anyway, if Inline::C and Inline::Java aren't in exactly the same boat here, it looks like they're at least part of the same fleet ;-)

    Hopefully Inline->init(); will solve the OP's problems.
    Thanks for chiming in, Patrick !

    Cheers,
    Rob
Re^7: Exporter Problem
by osler (Sexton) on Feb 25, 2013 at 01:52 UTC
    Worked perfectly, thanks!!!!!