Kirk,
Here's an example I worked out.
There were some things missing in my explanation:
1) You need to use the NAME directive to give all your Inline:Java objects
the same directory. In this case I used the "a" name.
2) You need to wipe out the contents of the Inline directory, not the
directory itself.
Try it out,
Patrick LeBoutillier
-----8<-----
#!/usr/bin/perl
use strict ;
BEGIN {
mkdir('./_Inline_test', 0777) unless -e './_Inline_test';
}
use Inline Config =>
DIRECTORY => './_Inline_test' ;
my @tests = split(/;;;;;/,<<'ETESTS');
Inline->bind(Java => <<'JAVA',
class a {
public a(){
}
public int get(){
return 5 ;
}
}
JAVA
NAME => "a"
) ;
my $a = new a() ;
print $a->get() . "\n" ;
;;;;;
Inline->bind(Java => <<'JAVA',
class b {
public b(){
}
public int get(){
return 6 ;
}
}
JAVA
NAME => "a"
) ;
my $b = new b() ;
print $b->get() . "\n" ;
ETESTS
foreach my $t (@tests){
`rm -Rf ./_Inline_test/*` ;
eval $t ;
if ($@){
die $@ ;
}
}
-----8<-----
----- Original Message -----
From: "Kirk Haines" <[EMAIL PROTECTED]>
To: "Patrick LeBoutillier" <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2001 11:04 AM
Subject: Re: Hopefully a simple Inline::Java question
> On Tue, 23 Oct 2001, Patrick LeBoutillier wrote:
>
> > - What does your "use Inline" line look like?
>
> use Inline;
> ...
> use Inline->bind(Java => <<'EOC');
> //now all of the java code for a given test.
> EOC
>
> > - Is all this code happening under the "Quris::TestTools" package?
> > It seems so since you access your objects in that package.
>
> In real use, not necessarily. That was just a simple example that I
> cooked up to experiment with this.
>
> > - What version of Inline.pm are you using?
>
> .23
>
> > - Would it be a problem for you have each test running under it's
> > own package? I'm pretty sure this would be a part of any clean
solution.
>
> Hmmm. I'll have to think about that. This is a framework that I use for
> my automated test suites for Perl code that I write. We do a lot of Java
> here, though, and several of our Java programmers know nothing else, so
> whatever I do, I need make it as simple as possible so that the Java
> programmers don't really need to know much Perl to implement their tests
> under the framework, but when they run the tests, they will work in
> exactly the same outward manner as the tests on Perl code.
>
> > A quick fix for you would be to delete your ".Inline" directory in
between
> > tests. You could specify a specific directory for your tests:
> >
> > use Inline Config =>
> > DIRECTORY => '~/._Inline_tests' ;
> >
> > and then wipe it (rm -Rf) in between tests. I haven't tried it yet but
it
> > should work. But in this case you couldn't benefit of the caching (every
> > time you run your tests they will be re-compiled). Let me know if that
works
> > out for you, and if it is acceptable.
> >
> > I have another somewhat cleaner idea but you would have to wait until
> > Inline::Java 0.30, which should be out soon.
>
> Awesome. I'll try using different directories as a stopgap solution.
> Thanks!
>
>
> Kirk Haines
>
>
>