Summary: system("lynx -dump") command in Perl

"A. Mahendra Rajah" <[email protected]>
Newsgroups gmane.os.tru64.managers
Message-ID <[email protected]>
  I asked why the following Perl statements would not produce
  the text file as desired using lynx:

  @Cmd = ($LYNX, "-cfg=$LYNX_CFG", "-dump ./$HTMLfile >| $TXTfile");
  $Stat = system(@Cmd);

  My thanks to these folks for taking the time to reply:
        Charles Ballowe 
        "J.A. Gutierrez" 
        Dr. Tim Cutts 
        "Farmer, John" 

  The following email from Dr Tim Cutts gives the complete answer
  to my problem:

...................................................................

  $Cmd = "$LYNX -cfg=$LYNX_CFG -dump ./$HTMLfile > $TXTfile";
  $Stat = system($Cmd);

  Would work.  >| doesn't mean anything in bourne shell syntax,
  which is what system() uses. Secondly, you can't use shell
  metacharacters if the arguments to system() are a list, because
  in list form, it just calls exec(2), and no intervening shell,
  so what would happen in your code is that lynx would be called
  with two arguments

  '-cfg=something'

  and

  '-dump ./something_else >| something_again'

  Which it probably doesn't understand.  See the perlfunc manpage
  entry for system, and also look at the manpage for the exec(3)
  C-library function, which will help you understand when an
  intervening shell is used and when it isn't.
...................................................................

  Thanks again for everyone who answered.

  -- mahendra
................................................................
  A. Mahendra Rajah             Email: [email protected]
  Tru64 UNIX Systems Manager    Phone:            (306) 585-4496
  Dept. of Computing Services   FAX:              (306) 337-2324
  University of Regina,
  Regina, Sask., S4S 0A2
  Canada.       
................................................................
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.