#!/usr/bin/perl open(RANDOM, "/dev/urandom") or die; read(RANDOM, $i, 4) or die; close(RANDOM); srand(unpack('I', $i)); %colours = ( "red" => "1.0 0.3 0.3", "green" => "0.3 1.0 0.3", "blue" => "0.3 0.3 1.0", "orange" => "1.0 0.6 0.3", "purple" => "1.0 0.3 0.6", "cyan" => "0.3 0.6 1.0", "yellow" => "1.0 0.9 0.1" ); # dimensions in cm $f_height = 12; $f_width = 12; $b_height = 11.8; $b_width = 15; $b_edge = 0.65; # offsets $b_ox = 2.0; $b_oy = 1.5; $f_ox = 2.0; $f_oy = $b_oy + 1.5 + $b_height; $margin = 0.5; # fonts $artist_font = "Helvetica"; $artist_size = 18; $title_font = "Helvetica-Bold"; $title_size = 22; $track_font = "Times-Roman"; $track_size = 11; $spine_size = 11; # input a file of information sub input_file { my $filename = shift(@_); my $track = 1; open(INPUT, "$filename"); while(my $line = ) { if ($line =~ /^[ \t]*track[ \t]*([0-9]*)[ \t]*=[ \t]*(.*)$/) { if ($1 ne undef) { $track = $1 } $tracks[$track++] = $2; } elsif ($line =~ /^[ \t]*artist[ \t]*=[ \t]*(.*)$/) { $artist = $1; } elsif ($line =~ /^[ \t]*title[ \t]*=[ \t]*(.*)$/) { $title = $1; } } close(INPUT); } input_file($ARGV[0]); print <$ARGV[1]"); # draw the cover outlines @cnames = keys(%colours); $colour = $colours{@cnames[int rand() * @cnames]}; # conversion factor from cm to PostScript points $conversion = 28.346457; print POSTSCRIPT <