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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
| #!/usr/bin/perl -w
use strict;
no strict 'vars';
package Personne;
my @listJob = ();
sub new {
#my $self={};
my ($class, $ID_PROCESS, $ALIAS, $PERE_PROCESS, $FILS_PROCESS, $LOCK, $TYPE) = @_;
my $this = {};
bless($this, $class);
$this->{ID_PROCESS} = $ID_PROCESS;
$this->{ALIAS} = $ALIAS;
$this->{PERE_PROCESS} = $PERE_PROCESS;
$this->{FILS_PROCESS} = $FILS_PROCESS;
$this->{LOCK} = $LOCK;
print "ID : $ID_PROCESS\n";
print "ALIAS : $ALIAS\n";
print "PERE_PROCESS : ";
foreach my $pere ( @{$PERE_PROCESS} ) {
print " $pere";
}
print "\n";
print "FILS_PROCESS : ";
foreach my $fils ( @{$FILS_PROCESS} ) {
print " $fils";
}
print "\n";
print "LOCK : $LOCK\n";
print "TYPE : $TYPE\n";
push(@listJob,$ID_PROCESS);
print "\n\n";
return $this;
}
sub getID {
my ($this) = @_;
return $this->{ID_PROCESS};
}
sub getAlias {
my ($this) = @_;
return $this->{ALIAS};
}
sub getPere {
my ($this) = @_;
return $this->{PERE_PROCESS};
}
sub getFils {
my ($this) = @_;
return $this->{FILS_PROCESS};
}
sub getLock {
my ($this) = @_;
return $this->{LOCK};
}
1;
my @pere = ("NULL");
my @fils = ("4", "5");
my $proc1 = new Personne( "1", "alias1", \@pere, \@fils, "unlock", "unknown");
my @pere = ("NULL");
my @fils = ("6");
my $proc2 = new Personne( "2", "alias2", \@pere, \@fils, "unlock", "unknown");
my @pere = ("NULL");
my @fils = ("8", "9");
my $proc3 = new Personne( "3", "alias3", \@pere, \@fils, "unlock", "unknown");
my @pere = ("1");
my @fils = ("7");
my $proc4 = new Personne( "4", "alias4", \@pere, \@fils, "unlock", "unknown");
my @pere = ("1");
my @fils = ("7");
my $proc5 = new Personne( "5", "alias5", \@pere, \@fils, "unlock", "unknown");
my @pere = ("2");
my @fils = ("8");
my $proc6 = new Personne( "6", "alias6", \@pere, \@fils, "unlock", "unknown");
my @pere = ("4", "5");
my @fils = ("8");
my $proc7 = new Personne( "7", "alias7", \@pere, \@fils, "unlock", "unknown");
my @pere = ("7", "5", "6", "3");
my @fils = ("NULL");
my $proc8 = new Personne( "8", "alias8", \@pere, \@fils, "unlock", "unknown");
my @pere = ("3");
my @fils = ("NULL");
my $proc9 = new Personne( "9", "alias9", \@pere, \@fils, "unlock", "unknown");
print "listJob : @listJob\n";
my $test = 9;
print ${"proc".$test}->{LOCK}."\n";
print $proc9->{LOCK}."\n"; |