Thread Problem mit Array aus Objekten (8 answers)
Opened by Gast at 2008-07-04 16:16

Gast Gast
 2008-07-04 17:12
#111824 #111824
Hier nochmal der Aufbau der Klasse Word:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package HTML_Indexer::Word;
use HTML_Indexer::Position;
use HTML_Indexer::HeadlinePosition;

my $wordname;
my @positions;
my @headline_positions;


sub new (){
        my $classname  = shift;     
        $wordname = shift; 
        print "Creating word: ".$wordname."\n";
        my $self       = {};            
        $counter++;
        return bless $self, $classname; 
};


sub addPosition(){
        my $classname  = shift;         # 1. Parameter Klassenname
        my $position = shift; 
        push @positions, $position; 
};


sub addPositions(){
        my $classname  = shift;         # 1. Parameter Klassenname
        my @pos = shift; 
        push @positions, @pos; 
};


sub getPositions(){
        return @positions; 
}

sub getName(){
        return $wordname;       
}

View full thread Problem mit Array aus Objekten