Dear all,

THere's probably a more convoluted way of catching errors, and using __FILE__ to warn, but I was just interested if this option exists:

My perl script runs through a huge number of files, all named in very similar ways. They only really differ in the paths they exist in.

My problem is that Im reducing any output, so I do NOT want to use any print statements that say 'current working path is blah blah', so my log file is truly an error file.

However, one common error occurs because of wrong naming conventions within particular files, and I need to accomodate for these naming conventions, but it takes me a long time to work out which file it is, and this is especially because my error says something like:

Can't call method "blahblah" on an undefined value at /path/to/Module. +pm line 505, <FILEDATA> line 11.

So my question is, can I get Perl to output the actual filepath, instead of the name of the filehandle?

Cheers
Sam


In reply to Forcing perl to print filenames instead by seaver

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.