| 1 | # | ||
| 2 | # $Id: JavaArray.pm,v 1.1.1.1 2003/11/17 22:08:07 zzo Exp $ | ||
| 3 | # | ||
| 4 | |||
| 5 | package JavaArray; | ||
| 6 | |||
| 7 | # Just keep track of java object | ||
| 8 | # A VERY (ridiculously so perhaps!) thin veneer over the stuff in Java.pm... | ||
| 9 | sub TIEARRAY | ||
| 10 | 0 | ▶ | { |
|
Subroutine
TIEARRAY: not called CC=1 SCAR=6.9
| |||
| 11 | 0 | my $class = shift; | |
| 12 | 0 | my $java_object = shift; | |
| 13 | |||
| 14 | 0 | return bless { | |
| 15 | java_object => $java_object, | ||
| 16 | }, $class; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub FETCH | ||
| 20 | 0 | ▶ | { |
|
Subroutine
FETCH: not called CC=1 SCAR=6.9
| |||
| 21 | 0 | my($self,$index) = @_; | |
| 22 | 0 | $self->get_object->get_field($index); | |
| 23 | } | ||
| 24 | |||
| 25 | sub STORE | ||
| 26 | 0 | ▶ | { |
|
Subroutine
STORE: not called CC=1 SCAR=6.9
| |||
| 27 | 0 | my($self,$index,$value) = @_; | |
| 28 | 0 | $self->get_object->set_field($index,$value); | |
| 29 | } | ||
| 30 | |||
| 31 | sub FETCHSIZE | ||
| 32 | 0 | ▶ | { |
|
Subroutine
FETCHSIZE: not called CC=1 SCAR=6.9
| |||
| 33 | 0 | my($self) = @_; | |
| 34 | 0 | $self->get_object->get_length; | |
| 35 | } | ||
| 36 | |||
| 37 | sub STORESIZE | ||
| 38 | 0 | ▶ | { |
|
Subroutine
STORESIZE: not called CC=1 SCAR=6.9
| |||
| 39 | 0 | my($self) = @_; | |
| 40 | 0 | $self->FETCHSIZE+1; | |
| 41 | } | ||
| 42 | |||
| 43 | #sub DESTROY | ||
| 44 | #{ | ||
| 45 | #my($self) = @_; | ||
| 46 | #$self->get_object->DESTROY; | ||
| 47 | #} | ||
| 48 | |||
| 49 | sub get_object | ||
| 50 | 0 | ▶ | { |
|
Subroutine
get_object: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 51 | 0 | my($self) = @_; | |
| 52 | 0 | $self->{java_object}; | |
| 53 | } | ||
| 54 | |||
| 55 | # Sneaky way to get actual java object outta this thang | ||
| 56 | # for function calls & such w/o having to keep around | ||
| 57 | # the actual object returned by 'tie' | ||
| 58 | sub POP | ||
| 59 | 0 | ▶ | { |
|
Subroutine
POP: not called CC=1 SCAR=6.9
| |||
| 60 | 0 | my($self) = @_; | |
| 61 | 0 | $self->get_object; | |
| 62 | } | ||
| 63 | 1 | 1; | |
| 64 | __END__ | ||