loosid has asked for the wisdom of the Perl Monks concerning the following question:


It was recomended that I post this here

This is the entire prog so far. It works without the use CGI, but once it is included the following error is produced:

No such file or directory at perl1.pl line 22. <STDIN> line 1.
use CGI qw(:standard); #use Win32::ODBC; use strict; use win32; my ($directory); my ($name); print "enter in directory \n"; chomp ($directory = <STDIN>); print "directory is $directory\n"; #Open the directory to list what's inside opendir(DIR, "c:/$directory") || die "Cannot open $directory $!"; foreach $name (sort readdir(DIR)) { #Prints names sorted print "$name\n"; } closedir(DIR);

It doesn't have anything to do with CGI yet, but it will. any help would be appreciated

Replies are listed 'Best First'.
Re: Opendir under WinNT using CGI
by Yohimbe (Pilgrim) on Feb 01, 2001 at 03:17 UTC
    STDIN is from the client posting to your server but a line by line read of it is probably not what you want to do.

    Something like the following is more robust, and more portable and has the advantage of working on the command line and in GET mode too. as in: /cgi-bin/foo.pl?c:/foo

    my $q= new CGI; @directory=$q->keywords(); opendir (DIR, chomp($directory[0]));

    --
    Jay "Yohimbe" Thorne, alpha geek for UserFriendly
Re: Opendir under WinNT using CGI
by the_slycer (Chaplain) on Feb 01, 2001 at 02:53 UTC
    Whoops.. I already posted for you... scroll down a bit for the answers.. sorry, I just couldn't wait for a solution, it was driving me crazy :-)