Extracting Information with ox.pl

The ox.pl program is the companion to oxgen.pl. It generates reports based on the information gathered by oxgen.pl.

The program itself is simple. First you grab the data stored by oxgen.pl:

35 my $object_xref = retrieve("object_xref.dat");

Then you print the entry for each symbol entered on the command line:

45      my $info = $object_xref–>{$sym}; 
46      if (not defined($info)) {
47          print "$sym:   UNDEFINED\n"; 
48          next; 
49      } 
50      # Print the information 
51      print "$sym\n"; 
52      print "    Defined: @{$info–>{'defined'}}\n"; 
53      print "    Used: @{$info–>{'used'}}\n";

That’s it—database retrieval and report generation in one easy lesson. The program is shown in its entirety in Listing 16.10.

Listing 16.10. ox.pl
 1 =pod 2 3 =head1 ...

Get Perl for C Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.