Súbor: [Platon] / scripts / perl / wml / index.cgi (stiahnutie)
Revízia 1.1, Tue Mar 29 16:11:44 2005 UTC (19 years, 10 months ago) by rajo
Simple Perl script for WML index of files in directory (like directory index from Apache)
|
#!/usr/bin/perl
#
# Create WML index of directory
#
# Developed by Lubomir Host 'rajo' <rajo AT platon.sk>
# Copyright (c) 2005 Platon SDG, http://platon.sk/
# Licensed under terms of GNU General Public License.
# All rights reserved.
#
# Changelog:
# 2005-03-29 - created
#
# $Platon$
use strict;
use CGI::Lite;
# here is directory with your files
my $subdir = "data";
chdir $subdir or die "Can't go to directory '$subdir': $!";
print "Content-Type: text/vnd.wap.wml; charset=utf-8\r\n";
print <<EOF
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<template>
<do type="Options" label="List of files"><go href=""/></do>
<do type="prev" label="Back"><prev/></do>
</template>
<card id="HTML" title="List of files">
<p>
<a href="index.cgi">Refresh</a><br/>
EOF
;
my @files = glob "*";
foreach my $file (@files) {
#print "file = '$file'\n";
print "<a href=\"$subdir/", CGI::Lite::url_encode($file), '">', $file, "</a><br/>\n";
}
print <<EOF
</p>
</card>
</wml>
EOF
Platon Group <platon@platon.sk> http://platon.sk/
|