On 07 Jan 03 at 09:36:16PM, Tim Dolezal wrote:

> Ian's worked great, except it kept repeating.

Huh? Did you have cycles in your input data? I should have mentioned
in the limitations that it expects acyclic input. I would assume
cycles are an error, since you are basically printing a tree. Cycle
detection is not hard to add.

I noticed that in your script's data, you don't have a root node
specified. Since 22222 doesn't have a parent, I assume that is the
root node of the whole tree.

I ran my script on the following data:

22222
123456 1438566
123457 1438566
123458 1438566
123459 1438566
123460 1438566
123461 1438566
123462 1438566
123463 1438566
123464 1438566
1438566 22222
564737 123458
564738 123458
564739 123458
564740 123458
564741 123458
571508 1438566
987651 571508
987652 571508
987653 571508
987654 571508
987655 987651
987656 987651
987657 987651
987658 987657


The output I get is:

| 
\-22222
  | 
  \-1438566
    | 
    \-123456
    | 
    \-123457
    | 
    \-123458
    | | 
    | \-564737
    | | 
    | \-564738
    | | 
    | \-564739
    | | 
    | \-564740
    | | 
    | \-564741
    | 
    \-123459
    | 
    \-123460
    | 
    \-123461
    | 
    \-123462
    | 
    \-123463
    | 
    \-123464
    | 
    \-571508
      | 
      \-987651
      | | 
      | \-987655
      | | 
      | \-987656
      | | 
      | \-987657
      |   | 
      |   \-987658
      | 
      \-987652
      | 
      \-987653
      | 
      \-987654


I don't see any problem with it.

Your script looks as though it is only going to try to print a subtree
rooted at 571508. If I use that as the root node, I get:

| 
\-571508
  | 
  \-987651
  | | 
  | \-987655
  | | 
  | \-987656
  | | 
  | \-987657
  |   | 
  |   \-987658
  | 
  \-987652
  | 
  \-987653
  | 
  \-987654

...which looks OK to me.

> Here is what I came up
> with on my own, with a little help from a friend at work. The second
> foreach in ShowPage is there to test what I will pass to Template.pm.
> 
> #!\usr\bin\perl
> 
> use strict;

<snip masses of interesting code>

----------

I ran it, and I got:

Upline -> personNumber
--> 1438566
        personNumber ->
571508
571508|

----------

Yeah, well, to each his own.


Ian Boreham

Reply via email to