Hi,
i'm using the code below to fill a svg template, and send it to the client. The problem is that the svg is not being diplayed by the client-side browser (IE6) - and when I try it in Netscape, it starts downloading as a file. If I click veiw>>source in IE, the svg source is displayed perfectly (after it has been downloaded - it will say Done even before its actually finished), but normally you right click in the browser window to view the source and the veiw>>source option would be disabled.
This is my first time displaying svg from the server - normally I open my *.svg docs from my PC and the browser handles them fine - Is it the cgi extention thats causing the problems?
Thanks.
Heres the exe
#!/usr/bin/perl -w use strict; my @colors = ( [167,45,37,56,65,67,56,78,231,35,142,20,187,137,19,107 +,117,127,137], # ... [221,245,237,0,0,0,0,0,235,235,145,220,218,146,194,46, +133,127,45,32] # ... ); print "Content-type: image/svg+xml\n\n"; open DATA, '<g3.svg' or die $!; local $" = ','; # localise $" ($LIST_SEPARATOR) and set it to b +e a comma s/^var colors(\d+) = \[\];/var colors$1 = "[@{ $colors[$1 - 1] }]";/ and print # and print it if it matched or print # otherwise just print them while <DATA>; close DATA or warn $!;

In reply to Sending SVG to Client by Baz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.