JavaArray

JavaArray is a tie'd extension for Java arrays from Java.pm
Download

JavaArray Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mark Ethan Trostler
  • Publisher web site:
  • http://search.cpan.org/~metzzo/Java-4.7/Java.pm

JavaArray Tags


JavaArray Description

JavaArray is a tie'd extension for Java arrays from Java.pm JavaArray is a tie'd extension for Java arrays from Java.pmSYNOPSIS use Java; # Set up Java.pm to always return tied array references to me my $java = new Java(use_tied_arrays => 1); my $tied_array = $java->create_array("java.lang.String",5); OR # Roll my own tied arrays my @tied_array; tie @tied_array, 'JavaArray', $java->create_array("java.lang.String",5); OR tie @tied_array, 'JavaArray', $some_object_that_is_an_array; // Set array element 3 to "Java is lame" $tied_array = "Java is lame"; // Get array element 3's value my $element = $tied_array->get_value(); // Get length my $length = scalar(@tied_array); my $size = $#tied_array; // Use as parameter you gotta pass the reference! my $list = $java->java_util_Arrays("asList",@tied_array); // NO OTHER ARRAY OPERATIONS ARE AVAILABLE! // so no pop or push or unshift or shift or splice // Hey even this can't make Java arrays cool! // use the Collections framework!This module puts a pretty thin veneer over Java.pm objects are are Java arrays. Makes 'em slightly prettier to play with. You can pass as an agrument to the 'tie' any Java object that is an array - either one you created yourself or one that was returned to you by something else.You probably should NOT be using this directly, but specify 'use_tied_arrays' in your constructor args to Java.pm.In parameter listsIf you want to use your array in a parameter list you've got to pass in the REFERENCE to your array or things will go haywire... If you specified 'use_tied_arrays' in your Java.pm constructor then you will only receive references back from Java.pm so you've already got the reference. ONLY if you call 'tie' yourself (& I can't really think of why you ever would... BUT) & get the array itself do you need to take its reference when using it in parameter lists.Automatic usageYou can tell Java.pm to automatically convert all Java arrays to their tied counterparts by setting 'use_tied_arrays' in your Java constructor. You will get receive a reference to the tied array so you must use the '->' notation like: $array-> = "Mark rox"; my $ele = $array->;See perldoc Java.pm for more info. You can then use that value directly in parameter lists. Requirements: · Perl


JavaArray Related Software