Note that distributions may actually split libtidy into two parts — what you need for runtime, and what you need for development. If you find a libtidy RPM package, you may also still need to search for a libtidy-dev package as well to get the headers you need to compile with.

As an aside, I had zero luck using HTML::Tidy. On my Debian system, it segfaulted as soon as I fed it a configuration option. I ended up writing my own system tidy wrappers for the project I'm currently working on (a set of ebook-related tools). Here's one of them, as an example for the curious:

# # sub system_tidy_xhtml($infile,$outfile) # # Runs tidy on a XHTML file semi-safely (using a secondary file) # Converts HTML to XHTML if necessary # # Arguments: # $htmlfile : The filename to tidy # # Global variables: # $tidycmd : the location of the tidy executable # $tidyconfig : the location of the config file to use # $tidyxhtmlerrors : the filename to use to output errors # $tidysafety: the safety factor to use # # Returns the return value from tidy # Dies horribly if the return value is unexpected # # Expected return codes from tidy: # 0 - no errors # 1 - warnings only (leave errorfile) # 2 - errors (leave errorfile and htmlfile) # sub system_tidy_xhtml { my $infile; my $outfile; my @configopt = (); my $retval; ($infile,$outfile) = @_; die("system_tidy_xhtml called with no input file") if(!$infile); die("system_tidy_xhtml called with no output file") if(!$outfile); @configopt = ('-config',"$datapath/$tidyconfig") if(-f "$datapath/$tidyconfig"); $retval = system($tidycmd,@configopt, '-q','-utf8', '-asxhtml', '--doctype','transitional', '-f',$tidyxhtmlerrors, '-o',$outfile, $infile); # Some systems may return a two-byte code, so deal with that first if($retval >= 256) { $retval = $retval >> 8 }; if($retval == 0) { rename($outfile,$infile) if($tidysafety < 4); unlink($tidyxhtmlerrors); } elsif($retval == 1) { rename($outfile,$infile) if($tidysafety < 3); unlink($tidyxhtmlerrors) if($tidysafety < 2); } elsif($retval == 2) { print STDERR "WARNING: Tidy errors encountered. Check ",$tidyxhtm +lerrors,"\n" if($tidysafety > 0); unlink($tidyxhtmlerrors) if($tidysafety < 1); } return $retval; }

In reply to Re: HTML::Tidy on Linux by AZed
in thread HTML::Tidy on Linux by jai_dgl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.