in reply to Re^2: Shortcutting namespaces in Inline::Java
in thread Shortcutting namespaces in Inline::Java

Whether using the studying features or not, you still have to import the .jar files to be able to use the shorter Perl syntax -- there is an example of that in the documentation I already linked under the studying section.
__________________________________________________________________________________

^M Free your mind!

  • Comment on Re^3: Shortcutting namespaces in Inline::Java

Replies are listed 'Best First'.
Re^4: Shortcutting namespaces in Inline::Java
by suaveant (Parson) on Apr 24, 2007 at 19:40 UTC
    I'm looking all over but I'm missing it... I see the bit on study_classes but that looks like the package argument it takes puts ALL the classes under that package.

                    - Ant
                    - Some of my best work - (1 2 3)

      If you want to keep the long-addressed class hierarchy but refer by shortname, that should be no problem anyway, the use of new in this example is the same either way. But the real point of this example is to demonstrate how to import with autostudy:
      use Inline Java => <<'END', AUTOSTUDY => 1 ; import java.util.* ; class Pod_10 { public Pod_10(){ } public HashMap get_hm(){ HashMap hm = new HashMap() ; return hm ; } } END my $obj = new Pod_10() ; my $hm = $obj->get_hm() ; $hm->put("key", "value") ; my $val = $hm->get("key") ; print($val . "\n") ; # prints value
      __________________________________________________________________________________

      ^M Free your mind!

      Key to hats: ^I=white ^B=black ^P=yellow ^E=red ^C=green ^M=blue - see Moron's scratchpad for fuller explanation.

        Yes, but in this example I would want to be able to call
        my $hm = HashMap->new(); #instead of my $hm = java::util::HashMap->new();
        in the Perl code, and that doesn't seem to work.

                        - Ant
                        - Some of my best work - (1 2 3)