Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^6: Exporter Problem

by Anonymous Monk
on Feb 23, 2013 at 03:06 UTC ( #1020270=note: print w/ replies, xml ) Need Help??


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


Comment on Re^6: Exporter Problem
Select or Download Code
Re^7: Exporter Problem
by syphilis (Canon) 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!!!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020270]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-09-02 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls