I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-02-11 17:25:12-08 by chrei
Class not found when CLASSPATH option contains '#'
Hi,

the following behaviour occurs when setting the classpath through the CLASSPATH configuration option (on Linux with Perl 5.8.8 and up-to-date modules). It does not appear when setting it through the CLASSPATH env variable or a -cp option in EXTRA_JAVA_ARGS. The latter is a bad idea as it circumvents Inline::Java's internal classpath tweaking and in my app the use of the env variable has its own sort of problems ... so here I am.

This is how to reproduce it:

1. Create file Pod_alu.java containing the following well-known piece of java code and compile it into file Pod_alu.class:

public class Pod_alu { public Pod_alu(){ } public int add(int i, int j){ return i + j ; } public int subtract(int i, int j){ return i - j ; } }

2. Create two subdirectories named "sub-dir" and "sub#dir".

3. Copy the Pod_alu.class file in both subdirectories.

4. Run this piece of Perl code:

use Inline( Java => 'STUDY', CLASSPATH => 'sub#dir', STUDY => [ 'Pod_alu' ], ); use Inline::Java; my $alu = new Pod_alu() ; print($alu->add(9, 16) . "\n") ; # prints 25 print($alu->subtract(9, 16) . "\n") ; # prints -7

The code should display a message like

Class Pod_alu not found at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Inline/Java.pm line 619 BEGIN failed--compilation aborted at p line 6, <GEN8> line 4.

When you change the CLASSPATH setting in the perl code from "sub#dir" to "sub-dir" it should work.

This behaviour is strange enough that I wanted to hear the forum's comments and having it reproduced by someone else before calling it a bug in Inline::Java. Java once had in fact a problem with '#' characters in the classpath (if I remember correctly back in 1.2 or even earlier) but that has long been fixed (at least I thought...).

Thanks for any comment.

Christian

Direct Responses: 7077 | Write a response