Basically if I just call the perl script from frontpage it runs in a dos window and then returns. I'm just trying to display the information within the browser using html formatting. I have no idea how to put the header information in to allow the page formatting to work.
Right now it partially works with statements I've found in other scripts but it prints the lines of code rather than the output.
What do I need in the perl script to use the CGI module and allow the page to display correctly.
#!c:\perl
print "Content-type:text/html\n\n";
print <<WEB_PAGE;
<html>
<title>Perl Script Directory</title>
<h1>Directory of c:\temp</h1>
WEB_PAGE
$dir = "C:\\temp";
unless (opendir(DIR, $dir)) {
&print_msg("\tCan't open $dir\n");
closedir(DIR);
exit(0);
}
foreach (readdir(DIR)) {
# don't include current dir or parent
next if $_ eq '.' || $_ eq '..';
$path = "$dir/$_";
if (-d $path) {
next;
#&traverse($path);
# check to see if file
} elsif (-f _) {
#if (!copy($path,"\\\\$Machine\\$Share{netname}\\temp\\")) {
# &print_msg("FAILED ($path) " . Win32::Lanman::GetLastErro
+r() . "\n");
#} else {
# &print_msg(".");
#}
#print "<P $path>\n";
print $path;
}
}
sleep (10);
print "</html>\n";
Edited by BazB: added code tags.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.