#!/usr/bin/perl -w
use strict;
use constant NL => qq[\012];

$| = 1;

use CGI::Carp qw(fatalsToBrowser);
print('Content-Type: text/html' . NL x 2);
print ${ &getINCarray() } and exit;

sub getINCarray {
   my $inc = '<blockquote><strong>@INC contains:</strong>' . NL;
   foreach (@INC) {
      $inc .= "<blockquote><strong>$_:</strong>" . NL;
      opendir(DIR, $_) or die ("error loading dir $_ $!" . NL);
      foreach (grep /.pm|.pod/i, readdir DIR) { $inc .= '<br>' . $_ . NL; }
      closedir(DIR);
      $inc .= '</blockquote>' . NL;
   }
   $inc .= '</blockquote>' . NL;
   return \$inc;
}