httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: CGI Tweak Take III
Date Sat, 03 Oct 1998 13:10:34 GMT

In article <9810030519.aa11494@paris.ics.uci.edu> you wrote:
>>  Here's my beefed-up cgi-bin/printenv again.

> Sorry, but it needs more work.
>[...]

6. The contents of variables should be split with a whitespace around every
   80-100 chars when the length of the content is really larger then 80-100
   chars _and_ no whitespaces are contained. Else your nice table gets totally
   messed up in browsers. Last time I debugged environment stuff for mod_ssl
   (where large Base64 encoded certificates exists, but same applies to large
   PATH variables, too) and was totally bothered by this problem.  My quick
   hack to workaround this was the following function (I'm sure it can be done
   a lot easier in Perl - I just had not much time when I wrote it, but feel
   free to add a similar functionality).

    sub splitval {
        my ($str, $col) = @_;

        my $out = '';
        while ($str ne '') {
            if (length($str) <= $col) {
               $out .= $str;
               last;
            }
            my $sep = rindex($str, " ", $col);
            if ($sep == -1) {
                $sep = $col;
                my $prefix = substr($str, 0, $sep);
                $str = substr($str, $sep);
                $out .= "$prefix...<br>\n...";
            }
            else {
                my $prefix = substr($str, 0, $sep);
                $str = substr($str, $sep);
                $out .= "$prefix<br>\n";
            }
        }
        return $out;
    }
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message