First off, the words, "code I found on the net" send shivers up the spine. My advice: look at the CPAN modules found here.

Having said that, let's take a look at a visually enhanced version of what you found.

sub print_html_page_w_ssi { # grab the .html filename passed as a parameter $a = shift; # zap any backslashes in the name # (note: we seem to be on a windows machine) $a =~ s/\\//g; # spiff up the filename, if needed $a = glob($a); # grab its contents (i.e. the html code itself) in $_ $_ = `cat $a`; # print out the http header print "Content-type: text/html\n\n"; # process any ssi tags in $_ one-by-one while ( /<!--#exec cgi="([^"]*)"-->/ ) { # now the name of the ssi file is in $1 # run that file and grab its output in $a $a = `$1`; # put a <br> with each line terminator $a =~ s/\n/<br>\n/g; # and substitute that output for # the ssi tag where it occurs in $_ s/<!--#exec cgi="([^"]*)"-->/$a/; } # print the resulting page (which is still # in $_) to the waiting web client print; }

In reply to Re: fake SSI by dvergin
in thread fake SSI by akm2

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.