GD::OrgChart - Perl extension for generating personnel organization charts
# This bit of code will display a simple orgchart using the # Imagemagick "display" command use GD::OrgChart; use constant FONT => "/some/path/to/truetype/fonts/times.ttf"; use IO::Pipe; our $COMPANY; # put data into $COMPANY such that it looks like: $COMPANY = { text => "Gary\nHome Owner", subs => [ { text => "Tex\nVice President, Back Yard Security", subs => [ { text => "Ophelia\nGate Watcher" }, { text => "Cinnamon\nDeck Sitter" }, ]}, { text => "Dudley\nVice President, Front Yard Security", subs => [ { text => "Jax\nBay Window Watcher" }, { text => "Maisie\nDoor Watcher" }, ]}, ]}; our $chart = GD::OrgChart->new({ size => 12, font => FONT }); $chart->DrawTree($COMPANY); our $fh = IO::Pipe->new; if (!$fh || !($fh->writer("display -"))) { # error ... } binmode $fh; # just in case our $image = $chart->Image; $fh->print($image->png); $fh->close();
Gary A. Algier, <gaa@magpage.com>
perl.
To install GD::OrgChart, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GD::OrgChart
CPAN shell
perl -MCPAN -e shell install GD::OrgChart
For more information on module installation, please visit the detailed CPAN module installation guide.