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

I have a set of Perl .t scripts that I want to run on a Windows box using Perl 5.6.1. I am using the runtests method of Test::Harness. However when I run the script it gives me the error

../t/mgtapi/new/createnew.can't run ../t/mgtapi/new/createnew.t. Bad f +ile descriptor FAILED before any test output arrived
Further investigation reveals that the following line fails in Harness.pm $fh->open($cmd) or print "can't run $test. $!\n";
Can anyone please provide me some pointers about what could be the possible reason?

Edit by BazB: add code tags, fix formatting slightly.

Replies are listed 'Best First'.
Re: Bad file descriptor
by Ultra (Hermit) on Mar 01, 2005 at 19:27 UTC
    First, i think you should preview your posts and reformat them as necessary
    Second, i did a grep on my Harness.pm and there is no "open" keyword in it (on GNU/Linux)
    Third, try running the test file manually, does it work?
    Dodge This!
Re: Bad file descriptor
by marinersk (Priest) on Mar 01, 2005 at 23:43 UTC
    Need more of your code snippet to figure out context. Mainly, what is $fhin your script? We are left to assume you did a my $fh = new Harness; or something, but somehow I bet that's not right. Especially given that there doesn't (according to Ultra) appear to be an open()method in the Test::Harnessmodule.
Re: Bad file descriptor
by rev_1318 (Chaplain) on Mar 02, 2005 at 11:24 UTC
    Further investigation reveals that the following line fails in Harness.pm $fh->open($cmd) or print "can't run $test. $!\n";

    Actually, that line works perfectly :-)
    It prints the errormessage, doesn't it? The problem is in your code, but without knowing what's in createnew.t we can only guess

    Please post (relevant) code which produces the behavour

    Paul