%#THIS FILE IS NOT PART OF MAKE DIST OR MAKE INSTALL %#make siteupdate copies it to /home/httpd/html/mason/abc-fakebook/index.html The package that creates the ABC tunes site is called ABC-Fakebook, and can be used to manage a gallery of ABC tunes. It requires:

Apache
Perl
HTML::Mason
Ghostscript
jcabc2ps
abc2midi

and assumes a Unixy environment.


<%perl> my $dir = '/home/httpd/html/mason/abc-fakebook'; my %outtext = (); opendir(DIR, $dir) || die "can't opendir $dir/ $!"; while (my $file = readdir(DIR)){ next unless $file =~ /\.tar.gz$/; my $age = (stat("$dir/$file"))[9]; my ($version) = $file =~ /abc-fakebook-(.+?)\.tar.gz/; $outtext{$version} = qq{$file @{[scalar localtime($age)]} Changes.txt
}; } closedir DIR; foreach my $version (reverse sort keys %outtext){ $m->out($outtext{$version}); }


The site is set up like this:

	autohandler
	config
	index.html
	abc-src/
		*.abc (the source abc files)
	abc/
		dhandler
	pdf/
		dhandler
	jpg/
		dhandler
	midi/
		dhandler

To add new .abc files, just drop them into the abc-src/ directory, everything else takes care of itself.

Requests to urls for abc/, pdf/, jpg/ or midi/ are handled by the dhandler in that directory which takes care of generating the requested file and caching it for future use.

The output is generated using subshells and temp files. I'd rather use pipes than tempfiles but not all the utilities are fully pipeable, and I wasn't able to find a good solution using two-way pipes and/or forking under mod_perl. I'm open to suggestions.

If you're curious, the commands used to generate the output looks like this:

jpg:
    | jcabc2ps 2>/dev/null | gs -sDEVICE=jpeg -sOutputFile=$tempfilename -q - -c quit 

midi:
    | abc2midi - -o $tempdir/output.mid

pdf:
    | jcabc2ps 2>/dev/null | gs -sDEVICE=pdfwrite -sOutputFile=$tempfilename -q - -c quit

abc: (transpose)
       abc2abc $path-to-file.abc -b -t $t |