job interview, n.: The excruciating process during which personnel officers separate the wheat from the chaff -- then hire the chaff.
TwitterLiked the quote? Tweet it!
see all quotes

Perl Timeline Script


Timeline, is a utility to draw diagrams that depict a time sequence of data, message or information exchange between entities or states. Such and similar diagrams are also known as Function Call Trees, Sequence Diagrams, or Chronological State Transition Diagrams in different contexts.

Using this simple open source perl script you can generate nice text formatted function call tree as per timeline, for use in emails to your colleagues to help them understand the logic of your module :) Save this file tl.pl.txt and rename it as "tl.pl".

Note: not this does not parse code to generate the call trees, you have to do it yourself. This only formats it nicely :)

The script is meant to be used thus :
Create a file, say 'myfile', with 3 columns - 'from' column, 'to' column and the function name. Thus :
1 2 func1
1 3 funcsd2
1 4 fundsc3
2 3 fundc4
2 4 funxc5
3 4 fuc6
1 4 fnc7
2 2 fddfunc8
3 3 fud9

Run the script thus :
cat myfile | tl.pl > outfile

The file 'outfile' should contain the formatted timeline.
t1 |----------func1>|................|................|
t2 |--------funcsd2-|--------------->|................|
t3 |--------fundsc3-|----------------|--------------->|
t4 |................|---------fundc4>|................|
t5 |................|---------funxc5-|--------------->|
t6 |................|................|-----------fuc6>|
t7 |-----------fnc7-|----------------|--------------->|
t8 |................|<=fddfunc8......|................|
t9 |................|................|<=fud9..........|

Just in case you find a little problem in your output, please have it corrected in any text editor ;) (Those dots there are actually spaces in outfile. Ive replaced them with dots here just to go easy on html)

Disclaimer: These files are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Message in Public Interest
Laughing ...

About

Human. Professional. Technologist. Musician. Naturophile. Linguaphile. Traveller. Philosopher. Friend. Don't-Worry-Be-Happy-ist.