in reply to File opening in ASP/Perlscript

Try this:

<SCRIPT language="PerlScript"> use Win32::Script qw/WScript/; $Shell = WScript('Shell'); $Exec = $Shell->Exec('cat a.txt'); $window->document->write($Exec->StdOut->ReadAll); </SCRIPT>

It prints the content of a.txt file.

With ASP/Perscript, you mostly only need to know how to use Win32::OLE, Win32::Script or other related Win32 wrapper modules. Otherwise, Microsoft COMs (related to ASP or your work) are what you should learn.

Replies are listed 'Best First'.
Re^2: File opening in ASP/Perlscript
by Aristotle (Chancellor) on Jul 28, 2003 at 00:17 UTC
    So how is that any better than the following?
    <SCRIPT language="PerlScript"> use Win32::Script qw/WScript/; my $content = do { local $/; my $fh; open $fh, '<', 'a.txt' ? <$fh> : "Couldn't open a.txt: $!;" }; $window->document->write($content); </SCRIPT>
    In fact I dare say it's worse - you were spawning an external process to read the file. There's sometimes something to be said for the brevity of qx{cat a.txt}, but you even gave up on that.

    Makeshifts last the longest.

      Whatever works is fine by me. I don't have any preference.