W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 1999

Re: Tidy and Perl

From: Peter Wiggin <peter@songline.com>
Date: Mon, 19 Jul 1999 09:21:53 -0700
Message-Id: <4.1.19990719091612.00a9ecd0@theriver.com>
To: "Neil Burnett" <neil@efc.be>, html-tidy@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT