Skip to Main Content
Wicked Cool Perl Scripts
book

Wicked Cool Perl Scripts

by Steve Oualline
February 2006
Intermediate to advanced content levelIntermediate to advanced
304 pages
6h 16m
English
No Starch Press
Content preview from Wicked Cool Perl Scripts

#45 Laying Out the Graph

You have the basic information about the regular expression. The next step is to lay things out. The size.pm module has two functions: it decides how big each element of the graph is and it decides where each element goes.

The Code

 1 use strict; 2 use warnings; 3 4 package size; 5 require Exporter; 6 7 use vars qw/@ISA @EXPORT format_re/; 8 9 @ISA = qw/Exporter/; 10 @EXPORT = qw/convert_re &BOX_FONT_SIZE 11 &X_CHAR_SIZE &X_MARGIN &Y_NODE_SIZE 12 &X_MARGIN &Y_MARGIN &MARGIN 13 &X_NODE_SIZE Y_NODE_SIZE 14 &X_BRANCH_MARGIN &Y_BRANCH_MARGIN 15 &X_TEXT_OFFSET &Y_TEXT_OFFSET 16 @format_re layout_array &BOX_MARGIN/; 17 18 # 19 # Constants that control the layout 20 # 21 # Margin around the graph 22 use constant MARGIN ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Debugged

Perl Debugged

Peter Scott, Ed Wright
Perl & LWP

Perl & LWP

Sean M. Burke
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 1593270623Catalog PageErrata