On Mon, Apr 28, 2014 at 7:30 AM, Reini Urban <rur...@cpanel.net> wrote:

> On 04/28/2014 09:09 AM, sisyph...@optusnet.com.au wrote:
>
>> From: Bill Moseley
>> Sent: Saturday, April 26, 2014 11:45 AM
>> To: inline@perl.org
>> Subject: Calling "use Inline" more than once?
>>
>>  Trying to work with some old code and noticed that "use Inline" is
>>> called multiple times in the same package.
>>>
>>> "use" is compile time, so I'm wondering if it makes sense to call "use
>>> Inline" multiple times in the same package -- or really in the same app.
>>>
>>
> use module ...; is basically expanded to
>
>   BEGIN {require module;}
>   module->import(...);
>
> What Inline does is calling the import method to generate the inlined
> parts. Multiple times.
>

In my case there's no inlined code -- so there's multiple instances of this
-- in each sub() in a single package.

sub foo {

    use Inline (
        Java => 'STUDY',
        SHARED_JVM => 1,
        STUDY => [
            'java.util.HashMap',
            'java.util.Iterator',
            'java.util.Set',
            'com.mcompany.some.class',
        ],
        DIRECTORY => '/tmp/',
        START_JVM => 0
    ) ;

And most have the same "STUDY" -- so wouldn't that just import the same
things over and over?   Some have slightly different STUDY, like this:

sub bar {

    use Inline (
        Java => 'STUDY',
        SHARED_JVM => 1,
        STUDY => [
            'java.util.HashMap',
            'com.mcompany.some.class',
        ],
        DIRECTORY => '/tmp/',
        START_JVM => 0
    ) ;

Seems like any importing in foo() would have covered whatever is imported
in bar().


-- 
Bill Moseley
mose...@hank.org

Reply via email to