chrism01 has asked for the wisdom of the Perl Monks concerning the following question:

Monks, When running this code:
$html_cvt_obj = new HTML::TextToHTML(); $html_cvt_obj->txt2html(infile=>[$cfg::inv_file], outfile=>$html_file, explicit_headings=>1, hrule_min=>20, preformat_trigger_lines=>0, );
on Linux 2.6.10-1.770_FC3smp #1 SMP Thu Feb 24 14:20:06 EST 2005 i686 i686 i386 GNU/Linux with perl, v5.8.5 built for i386-linux-thread-multi Copyright 1987-2004, Larry Wall,
the conversion is fine.

When run on Linux 2.4.20-28.8bigmem #1 SMP Thu Dec 18 11:50:42 EST 2003 i686 i686 i386 GNU/Linux with perl, v5.8.0 built for i386-linux-thread-multi (with 1 registered patch, see perl -V for more detail) Copyright 1987-2002, Larry Wall,
the conversion still works fine, but for each file I also get the following msg:

Inappropriate ioctl for device

Does anybody know an easy way to prevent the error msg occuring or know why it does. Given the 2nd box is a prod system, I am unlikely to be able to change it, unless this is symptomatic of a serious underlying issue.
Thanks
Chris

Replies are listed 'Best First'.
Re: HTML::TextToHTML : ioctl error using txt2html method
by PodMaster (Abbot) on Dec 05, 2005 at 07:30 UTC
    the conversion still works fine, but for each file I also get the following msg
    Where does the message come from? The snippet of code you've shown doesn't seem like the cause (update: try to find the exact line). Try adding
    use strict; use warnings; use diagnostics;
    and see if that helps you narrow it down. If it doesn't, try to use Devel::Trace.

    update: HTML::TextToHTML has a debug option, that might also help you narrow it down (might be easier than using Devel::Trace).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: HTML::TextToHTML : ioctl error using txt2html method
by Moron (Curate) on Dec 05, 2005 at 09:45 UTC
    In addition, this quick check represents a popular approach
    use Data::Dumper; my $dbg = 10; # set debug case no. or 0 for no case debugging #... $html_cvt_obj = new HTML::TextToHTML(); if ( $dbg == 10 ) { print STDERR Dumper( \$cfg::infile, \$html_file, \$html_cvt_obj ); die "Aborting after fulfilling debug case no. 10\n"; } $html_cvt_obj->txt2html(infile=>[$cfg::inv_file], outfile=>$html_file, explicit_headings=>1, hrule_min=>20, preformat_trigger_lines=>0, );

    -M

    Free your mind

Re: HTML::TextToHTML : ioctl error using txt2html method
by chrism01 (Friar) on Dec 05, 2005 at 23:15 UTC
    Guys,
    I tried both suggestions.
    Here's a minimal version that shows the problem:
    #!/usr/bin/perl -w use HTML::TextToHTML; use strict; use diagnostics; use Data::Dumper; use warnings; my ( $html_cvt_obj ); $html_cvt_obj = new HTML::TextToHTML(); # print STDERR Dumper( \"test.txt", \"test.html", \$html_cvt_obj ); # exit; $html_cvt_obj->txt2html(infile=>["test.txt"], outfile=>'test.html', explicit_headings=>1, hrule_min=>20, preformat_trigger_lines=>0, ); print "$! \n" if( $! );

    This still produces the same msg, even though the conversion works.
    If I turn on the Dumper and exit lines, I get the following output:
    $VAR1 = \'test.txt'; $VAR2 = \'test.html'; $VAR3 = \bless( { 'escape_HTML_chars' => 1, '__links_table' => {}, 'use_preformat_marker' => 0, 'style_url' => '', 'make_anchors' => 1, 'preformat_end_marker' => '^(:?(:?&lt;)|<)/PRE(:?(: +?&gt;)|>)$', 'par_indent' => 2, 'doctype' => '-//W3C//DTD HTML 3.2 Final//EN', 'links_dictionaries' => [], 'inhandle' => [], 'append_file' => '', 'short_line_length' => 40, 'preformat_trigger_lines' => 2, 'lower_case_tags' => 0, 'bold_delimiter' => '#', 'title' => '', 'tab_width' => 8, '__call_init_done' => 0, 'indent_par_break' => 0, '__non_header_anchor' => 0, '__mode' => 0, 'bullets' => '-=o*\\267', 'custom_heading_regexp' => [], 'make_tables' => 0, 'underline_offset_tolerance' => 1, 'preformat_start_marker' => '^(:?(:?&lt;)|<)PRE(:?( +:?&gt;)|>)$', '__links_table_order' => [], 'preserve_indent' => 0, '__num_heading_styles' => 0, 'unhyphenation' => 1, '__prev_para_action' => 0, 'hrule_min' => 4, 'use_mosaic_header' => 0, 'extract' => 0, 'endpreformat_trigger_lines' => 2, 'demoronize' => 1, '__search_patterns' => [], '__heading_styles' => {}, 'infile' => [], 'prepend_file' => '', 'outfile' => '-', 'xhtml' => 0, 'preformat_whitespace_min' => 5, 'debug' => 0, 'explicit_headings' => 0, 'italic_delimiter' => '*', 'dict_debug' => 0, '__repl_code' => [], '__list_nice_indent' => '', 'eight_bit_clean' => 0, '__listnum' => 0, 'bullets_ordered' => '', 'link_only' => 0, 'default_link_dict' => '/root/.txt2html.dict', 'table_type' => { 'DELIM' => 1, 'ALIGN' => 1, 'PGSQL' => 1, 'BORDER' => 1 }, 'underline_length_tolerance' => 1, '__global_links_data' => ' }, 'underline_length_tolerance' => 1, '__global_links_data' => ' /&lt;URL:([-\\w\\.\\/:~_\\@]+):([a-zA-Z0-9\'() ]+)&gt;/ -h-> <A HREF=" +$1">$2</A> /&lt;URL:\\s*(\\S+?)\\s*&gt;/ -h-> <A HREF="$1">$1</A> /&lt;(http:\\S+?)\\s*&gt;/ -h-> &lt;<A HREF="$1">$1</A>&gt; |snews:[\\w\\.]+| -> $& |news:[\\w\\.]+| -> $& |nntp:[\\w/\\.:+\\-]+| -> $& |http:[\\w/\\.:\\@+\\-~\\%#?=&;,]+[\\w/]| -> $& |shttp:[\\w/\\.:+\\-~\\%#?=&;,]+| -> $& |https:[\\w/\\.:+\\-~\\%#?=&;,]+| -> $& |file:[\\w/\\.:+\\-]+| -> $& |ftp:[\\w/\\.:+\\-]+| -> $& |wais:[\\w/\\.:+\\-]+| -> $& |gopher:[\\w/\\.:+\\-]+| -> $& |telnet:[\\w/\\@\\.:+\\-]+| -> $& |([^\\w\\-/\\.:\\@>])(alt\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(bionet\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(bit\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(biz\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(clari\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(comp\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(gnu\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(humanities\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HREF="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(k12\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(misc\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(news\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(rec\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(soc\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(talk\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(us\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(ch\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |([^\\w\\-/\\.:\\@>])(de\\.[\\w\\.+\\-]+[\\w+\\-]+)| -h-> $1<A HRE +F="news:$2">$2</A> |(anonymous\\@)([a-zA-Z][\\w\\.+\\-]+\\.[a-zA-Z]{2,}):(\\s*)([\\w\\d+\ +\-/\\.]+)| -h-> $1<A HREF="ftp://$2/$4">$2:$4</A>$3 |(ftp\\@)([a-zA-Z][\\w\\.+\\-]+\\.[a-zA-Z]{2,}):(\\s*)([\\w\\d+\\-/\\. +]+)| -h-> $1<A HREF="ftp://$2/$4">$2:$4</A>$3 |[a-zA-Z0-9_\\+\\-\\.]+\\@([a-zA-Z0-9][\\w\\.+\\-]+\\.[a-zA-Z]{2,})| -> mailto:$& |([^\\w\\-/\\.:\\@>])([a-zA-Z][\\w\\.+\\-]+\\.[a-zA-Z]{2,}):(\\s*)([\\ +w\\d+\\-/\\.]+)| -h-> $1<A HREF="ftp://$2/$4">$2:$4</A>$3 |([^\\w\\-/\\.:\\@])(\\d{2,}\\.\\d{2,}\\.\\d+\\.\\d+):([\\w\\d+\\-/\\. +]+)| -h-> $1<A HREF="ftp://$2/$3">$2:$3</A> |telnet ([a-zA-Z][\\w+\\-]+(\\.[\\w\\.+\\-]+)+\\.[a-zA-Z]{2,})\\s+(\\d +{2,4})| -h-> telnet <A HREF="telnet://$1:$3/">$1 $3</A> |ftp ([a-zA-Z][\\w+\\-]+(\\.[\\w\\.+\\-]+)+\\.[a-zA-Z]{2,})| -h-> ftp <A HREF="ftp://$1/">$1</A> |\\b([a-zA-Z][\\w])*ftp[\\w]*(\\.[\\w+\\-]+){2,}| -h-> ftp <A HREF="ft +p://$&/">$&</A> |ftp(\\.[a-zA-Z0-9_\\@:-]+)+/\\S+| -> ftp://$& |www(\\.[a-zA-Z0-9_\\@:-]+)+/\\S+| -> http://$& |\\b([a-zA-Z][\\w])*www[\\w]*(\\.[\\w+\\-]+){2,}| -> http://$&/ |([a-zA-Z][\\w+\\-]+\\.[\\w+\\-]+\\.[a-zA-Z]{2,})\\s+(\\d{2,4})| -h-> <A HREF="telnet://$1:$2/">$1 $2</A> |([^\\w\\-/\\.:\\@])(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\s+(\\ +d{1,4})| -h-> $1<A HREF="telnet://$2:$3">$2 $3</A> |([^\\w\\-/\\.:\\@])(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})| -h-> $1<A HREF="telnet://$2">$2</A> /RFC ?(\\d+)/ -i-> http://www.cis.ohio-state.edu/rfc/rfc$1.txt /([ \\t\\n])_([a-z][a-z0-9 -]*[a-z])_([ \\t\\n\\.;:,\\!\\?])/ -hi-> $1 +<U>$2</U>$3 "Seth Golub" -io-> http://www.aigeek.com/ "txt2html" -io-> http://txt2html.sourceforge.net/ "Kathryn Andersen" -io-> http://www.katspace.com/ "HTML::TextToHTML" -io-> http://www.katspace.com/tools/text_to_html/ "hypertoc" -io-> http://www.katspace.com/tools/hypertoc/ "HTML::GenToc" -io-> http://www.katspace.com/tools/hypertoc/ ', 'indent_width' => 2, 'mailmode' => 0, 'instring' => [], 'append_head' => '', 'caps_tag' => 'STRONG', 'min_caps_length' => 3, '__file' => '', 'make_links' => 1, '__list_indent' => [], 'titlefirst' => 0, 'body_deco' => '' }, 'HTML::TextToHTML' );

    I hope this means something to somebody, because it's just line noise to me... ;-)
    Cheers
    Chris
    PS, I'll take a look at the module's debug option...
      Replying to myself... tried debug option, looks same as Dumper (twice!). Mind you the Module's CPAN page does say "Don't bother, it's just for the developer". I wouldn't disagree :-)
      Chris
      So print "$! \n" if( $! ); is the line that prints the error message? $! could be set by a whole lot functions, so the only way $! is useful is if you check it after each call (HTML::TextToHTML's job).

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.