#!/usr/bin/perl

use strict;

chdir '/usr/local/apache'; # This should be your ServerRoot
parse ('conf/httpd.conf'); # This should be your main conf file
exit;

sub parse {
	my $target    = shift;
	my $conffile  = undef;
	my $fh        = undef;;
	if (-d $target) { $target .= '/*'; }
	foreach $conffile (glob($target)) {
		open $fh, ("<$conffile") or die "Cannot open $conffile\n";
		while (<$fh>) {
			/^\s*Server(Name|Alias)/ && print;
			/^\s*Include\s(\S+)/ && parse ($1);
		}
		close $fh;
	}
	return;
}
