Joseph Hall invented Perl Graphical Structures, which he used in Effective Perl Programming and we used in Intermediate Perl. To make the images for the first and second editions, I wrote PeGS::PDF (on Github).
I used this to create all of the PeGS structures in the book. Here are a couple of examples, which you can also find in the distribution. I can make the basic structures from Learning Perl as well as the references and structures from this book. I can’t make arbitrarily deep structures because I didn’t do the work to recursively place everything in non-overlapping spaces.
#!/usr/local/bin/perl use PeGS::PDF; my $W = 1.50 * 72; my $H = 2.25 * 72; my $pdf = PeGS::PDF->new( { file => "/Users/brian/Desktop/array.pdf", 'x' => $W, 'y' => $H, } ); die "Could not create object!" unless ref $pdf; $pdf->make_array( '@cats', [ qw(Buster Mimi Ginger Ella) ], 10, 120 ); $pdf->close;
I can also make a hash.
#!/usr/local/bin/perl use PeGS::PDF; my $W = 2.5 * 72; my $H = 2.25 * 72; my $pdf = PeGS::PDF->new( { file => "/Users/brian/Desktop/hash.pdf", 'x' => $W, 'y' => $H, } ); die "Could not create object!" unless ref $pdf; my %microchips = qw( Buster 1435 Mimi 9874 Ella 3004 Ginger 5207 ); $pdf->make_hash( '%microchips', \%microchips, 10, 120 ); $pdf->close;