Greetings to all,
So, in Perl, the following two pieces of code are equivalent:
$output = qx/ls/ ;
print $output ;
and
use Win32::Script qw/WScript/ ;
$output = WScript('Shell')->Exec("ls")->StdOut->ReadAll ;
print $output ;
(except that WScript will use \r\n instead of \n as end of line).
Not so with ActiveState's PerlScript used as the client-sided scripting language in HTML Applications (HTA--a Windows-specific thingy--basically HTML page running on IE on client machine without the security). Consider the following in a HTA page:
<SCRIPT language="PerlScript">
$output = qx/ls/ ;
$window->document->write($output) ;
</SCRIPT>
and
<SCRIPT language="PerlScript">
use Win32::Script qw/WScript/ ;
$output = WScript('Shell')->Exec("ls")->StdOut->ReadAll ;
$window->document->write($output) ;
</SCRIPT>
qx returned nothing, whereas WScript worked as expected. If I do:
<SCRIPT language="PerlScript">
qx/ls > output.txt/ ;
</SCRIPT>
output.txt would be created with results in it, so I know qx did execute the command.
Why such behavior, anyone knows?
Thanks (and thanks to grantm for giving me some pointers).
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.