Convert your HoH into an AoH. To do that, you need to create a second entry in your HoH that contains successors. So, your datastructure needs to look like:
$hash={
'MEX1J' => {
'desc' => 'Job 2'
'pred' => [TEX1J],
'succ' => [MEX2J],
},
'MEX2J' => {
'desc' => 'Job end'
'pred' => [TEX1J,MEX1J],
'succ' => [],
},
'TEX1J' => {
'desc' => 'Job start'
'pred' => [],
'succ' => [MEX2J],
}
}
That way, you can start to build your job execution tree.
Of course, I would build this using some sort of directed graph instead of a HoH. That way, predecessors and successors would be handled for you.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?