in reply to Re^6: Can't locate IO/Scalar.pm in @INC (@INC contains: /opt/rocks/lib/perl5/5.8.8/
in thread Can't locate IO/Scalar.pm in @INC (@INC contains: /opt/rocks/lib/perl5/5.8.8/

Unfortunately, there's no guarantee the error code is related to the problem. That would be fine if that was our only tool, but previously suggested strace provides the same data more accurately.

  • Comment on Re^7: Can't locate IO/Scalar.pm in @INC (@INC contains: /opt/rocks/lib/perl5/5.8.8/
  • Download Code

Replies are listed 'Best First'.
Re^8: Can't locate IO/Scalar.pm in @INC (@INC contains: /opt/rocks/lib/perl5/5.8.8/
by Anonymous Monk on Apr 25, 2009 at 16:24 UTC
    Are you sure? Looking at the source of the message, I think you can
    3531 SAVECOPFILE_FREE(&PL_compiling); 3532 CopFILE_set(&PL_compiling, tryrsfp ? tryname : name); 3533 SvREFCNT_dec(namesv); 3534 if (!tryrsfp) { 3535 if (PL_op->op_type == OP_REQUIRE) { 3536 const char *msgstr = name; 3537 if(errno == EMFILE) { 3538 SV * const msg 3539 = sv_2mortal(Perl_newSVpvf(aTHX_ "%s: %s", +msgstr, 3540 Strerror(errno))); 3541 msgstr = SvPV_nolen_const(msg); 3542 } else { 3543 if (namesv) { /* did we lookup +@INC? */ 3544 AV * const ar = GvAVn(PL_incgv); 3545 I32 i; 3546 SV * const msg = sv_2mortal(Perl_newSVpvf(aTH +X_ 3547 "%s in @INC%s%s (@INC contains:", 3548 msgstr, 3549 (instr(msgstr, ".h ") 3550 ? " (change .h to .ph maybe?)" : ""), 3551 (instr(msgstr, ".ph ") 3552 ? " (did you run h2ph?)" : "") 3553 )); 3554 3555 for (i = 0; i <= AvFILL(ar); i++) { 3556 sv_catpvs(msg, " "); 3557 sv_catsv(msg, *av_fetch(ar, i, TRUE)); 3558 } 3559 sv_catpvs(msg, ")"); 3560 msgstr = SvPV_nolen_const(msg); 3561 } 3562 } 3563 DIE(aTHX_ "Can't locate %s", msgstr); 3564 }
    strace is fine, but since it already gives an error message, maybe it should also include Strerror(errno))?
      Ok, now I'm sure you can.

      require says The file is included via the do-FILE mechanism, which is essentially just a variety of "eval".

      And do says If "do" cannot read the file, it returns undef and sets $! to the error.

        ok, I'll take that. Of course, $! is only meaningful if require got as far as the "do", but we know that to be the case here.