Re: Tidy and Perl

I guess it depends on where your input, output and stderr are coming from/going

I used the following in a CGI which grabs a URL, feeds the page to STDIN
and returns STDOUT, but doesn't do anything with STDERR:

$TIDYCOMMAND = '/usr/local/tidy/tidy -config /usr/local/tidy/config.txt';
$| = 1;

  use IPC::Open2;
  
  open2 (*TIDYREAD, *TIDYWRITE, $TIDYCOMMAND) or die "cannot open
$TIDYCOMMAND $!\n";
  print TIDYWRITE $html;
  close TIDYWRITE;
    
  while ( <TIDYREAD> ) {
    print STDOUT "$_";
  }
  close TIDYREAD;

If you want to do something with STDERR - you can use Open3.

Hope that helps.

Peter

At 09:28 AM 7/19/99 +0200, Neil Burnett wrote:
>To save reinventing the wheel, can anyone tell me the best way to use Tidy
>from a Perl script please? I assume there is a better way than:
>
>system(tidy." $cmdlineoptions")
>
>or is that the way?
>
>Thanks
>
>Neil
>
>
>

-----------------------------------------------------------
  Peter Wiggin			peter@songline.com
  Developer & Producer
  Songline Studios, Inc		http://www.songline.com
  (707) 829 6531
-----------------------------------------------------------

Received on Monday, 19 July 1999 12:24:33 UTC