I fell incredibly stupid that I can't get such a simple thing to work.
I'm trying to display the source of XML files without allowing IE to parse
them, but it still is parsing it:(

here is the relevant code:

sub ShowFile
{
    my $q        = shift;
    my $file     = shift;
    my $fileName = '';

    SWITCH:
    {
        $file eq 'xml'  and $fileName  =
"/usr/local/apache/htdocs/connect/connect.xml"  and last SWITCH;
        $file eq 'xsl1' and $fileName  =
"/usr/local/apache/htdocs/connect/connect1.xsl" and last SWITCH;
    }

    my $fh = IO::File->new ($fileName) or die "opening $fileName failed:
$!\n";

    print $q->header (-type => "text/plain");
    while (<$fh>)
    {
        print;
    }
}

sub Main
{
    my $q = CGI->new;

    my $action = $q->param ("action") || "showmenu";
    my $style  = $q->param ("style")  || "none";
    my $file   = $q->param ("file")   || "none";

    if ($action eq "showpage")
    {
        my $res = eval {ShowPage ($q, $style)};
        if ($@)
        {
            print $q->h1 ("Your xml has the following error: $@");
        }
        elsif (!$res)
        {
            print $q->h1 (qq/I don't know what xsl should be used for style:
"$style"/);
        }
    }
    elsif ($action eq "showfile")
    {
        eval {ShowFile ($q, $file)};
        if ($@)
        {
            print $q->h1 ("$@");
            ShowMenu;
        }
    }
    else
    {
        ShowMenu ($q);
    }
}


any ideas as to why?

TIA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to