---------- Forwarded message ----------
From: Patrick LeBoutillier <[EMAIL PROTECTED]>
Date: Fri, Oct 10, 2008 at 5:11 PM
Subject: Re: Wrapping Inline::Java elegantly?
To: Scott Serr <[EMAIL PROTECTED]>


Try something like this:

 package BOB;
 use Inline (
     Java => 'STUDY',
     STUDY => [],
 ) ;
 use Inline::Java qw(study_classes) ;


 sub import {
 my $class = shift;
 Inline::Java->study_classes([EMAIL PROTECTED], undef);
 }


That should bind the Java classes to your BOB package, i.e.
BOB::JavaClass1, BOB::JavaClass2.

This is explained a bit at the end of this section:
http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod#STUDYING


Patrick



On Fri, Oct 10, 2008 at 4:27 PM, Scott Serr <[EMAIL PROTECTED]> wrote:
> Michael Peters wrote:
>>
>> I hope I'm not stating the obvious here, but anything you pass to a "use"
>> statement in addition to the module name get's passed into that module's
>> import() sub. Exporter just makes this easy by giving you some vars to play
>> with and it's own import() sub.
>>
>> Ditch Exporter and write your own import() sub to take the list that you
>> want and pass it to Inline::Java's import() sub. Something like this:
>>
>> package BOB;
>> use Inline::Java;
>>
>> sub import {
>>  my $class = shift;
>>  Inline::Java->import(@_);
>> }
>>
> It's getting passed into the module now, I've verified that:
>
> sub import {
>  my $class = shift;
>  print @_, "\n";
> }
>
>
> Problem is...  using Inline::Java->import(@_); doesn't seem to work.  It's
> not exporting the Java class for this module or the caller to see.  I
> suspect it's some of magic of Inline Java, having to get at it with the
> 'STUDY' directives...  Maybe not, from here everyone looks like an expert.
>
> When trying to access a Java class I get:
> "JavaClass1" is not exported by the Inline::Java module
>
> Thanks,
> Scott
>
>



--
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada



-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada

Reply via email to