Leser: 1
|< 1 2 >| | 14 Einträge, 2 Seiten |
1
2
3
4
5
6
7
package subclass;
@ISA = (baseclass);
sub new {
my $self = {};
bless $self;
return $self;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class tree_node
{
var $parent;
var $child;
var $module;
var $name;
var $titel;
function tree_node($a=NULL, $b=NULL, $c=NULL, $d=NULL,$e=NULL){
$this->parent=$a;
$this->child=$b;
$this->module=$c;
$this->name=$d;
$this->titel=$e;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package document;
use strict;
sub new {
my ( $class ) = @_;
my $self = {
parent => undef,
child => undef,
doc_kind => undef,
name => undef
spalteninfo => undef
};
bless( $self, $class );
return $self;
}
sub parent {
my ( $self, $parent ) = @_;
$self->{parent} = $parent if defined($parent);
return $self->{parent};
}
1
2
3
4
5
sub parent {
my ( $self, $parent ) = @_;
$self->{parent} = $parent if defined($parent);
return $self->{parent};
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sub parent {
my ( $self, @parent ) = @_;
$self->{parent} = $parent[0] if scalar(@parent);
return $self->{parent};
}
# oder
sub parent2 {
my $self = shift @_;
my ($parent) = @_;
if( scalar @_ ) {
$self->{parent2} = $parent;
}
return $self->{parent2};
}
1
2
3
4
5
6
7
8
9
10
my $foo = Foo->new;
$foo->child(...);
$foo->parent(...);
package Foo;
use Moose;
has 'parent';
has 'child';
1;
|< 1 2 >| | 14 Einträge, 2 Seiten |