Hello monks, I have a script which has been running fine on another system that was retired last week. We have a new system which is very similar and where I installed all the required modules. However on this system I have problems using IO:Handle and Inline::Files. See code below of the test case which fails. Any help is appreciated, I've been spending hours trying to figure out why it fails, granted I'm no perl expert. The runtime error is: Bad file descriptor at io.pl line 19.
#!/usr/bin/perl use Inline::Files; use IO::Handle; sub headerprint { print "headerprint"; } sub indexsectionprint { my $sectiontitle = shift(@_); my $datatitle = shift(@_); my $indextitle = lc $sectiontitle; my $fh; $indextitle =~ s/ /_/g; $file = "index." . $indextitle . ".html"; print STDERR $file,"\n"; open OUTPUT, '>', "index.network.html" or die "Can't open section fi +le: $!"; STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!; headerprint(); } indexsectionprint("Network", $NETWORK); __NETWORK__ test

In reply to unusual behaviour with Inline-Files and IO-Handle by Peamasii

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.