lawlist has asked for the wisdom of the Perl Monks concerning the following question:
<!--#include file="header.include.shtml" --> <hr COLOR="#CCCCCC" size=1 NOSHADE> <!--#exec cgi="/cgi-bin/test.cgi"--> <!--#include file="footer.include.shtml" -->
#!/usr/bin/perl use CGI qw(:standard); print "Content-type: text/html\n\n"; my $dir = '/home/lawlist/www'; my $query = new CGI; my $name = $query->param('name'); my $file = $dir . "/" . $name; if ($name) { open(FILE,'/home/lawlist/www/header.include.shtml') and print <FILE> +; close FILE; } opendir(DIR, $dir) or die $!; while (my $file = readdir(DIR)) { next unless (-f "$dir/$file"); next unless ($file =~ m/\.txt|.el$/); print '<a href="/cgi-bin/test.cgi?name=' . $file . '">' . $file . "< +/a>" . "<br>" . "\n\n"; } closedir(DIR); if ($name) { open (DATA, $file) or return $self->print_json_error($self->language +('ERR_CANNOT_OPEN', $file->{name}, $!)); read (DATA, my $file, -s DATA); close DATA; print "<br>\n\n<br>\n\n"; print '<pre class="brush: lisp">' . "\n\n" . $file . "\n" . '</pre> +'; print "\n\n<br>\n"; open(FILE,'/home/lawlist/www/footer.include.shtml') and print <FILE> +; close FILE; } exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is it possible to output to an open web page?
by InfiniteSilence (Curate) on Apr 28, 2014 at 18:19 UTC | |
|
Re: Is it possible to output to an open web page?
by amon (Scribe) on Apr 28, 2014 at 18:23 UTC | |
|
Re: Is it possible to output to an open web page?
by zentara (Cardinal) on Apr 28, 2014 at 18:32 UTC | |
by karlgoethebier (Abbot) on Apr 28, 2014 at 19:10 UTC | |
by lawlist (Initiate) on Apr 28, 2014 at 20:49 UTC |