in reply to RE: Re: How to tell eval where the code is from
in thread How to tell eval where the code is from

I thought of this after I posted.

I actually think that your original approach is the right idea, wrong syntax. A better approach probably would be to provide a second optional argument to eval() that is the name to call this error.

In any case I suggest that you sign up for the perl5-porters list, state your problem, state your proposed solution, and see if you cannot get it accepted. Possibly with the syntax I am recommending. Possibly with some better syntax that they think of.

  • Comment on RE: RE: Re: How to tell eval where the code is from

Replies are listed 'Best First'.
RE: RE: RE: Re: How to tell eval where the code is from
by merlyn (Sage) on Aug 08, 2000 at 16:38 UTC
      Live and learn!

      Is this documented anywhere? Other than in your brain and the code?

        perlsyn (yeah, the one nobody reads {grin}) says:
        Plain Old Comments (Not!) Much like the C preprocessor, Perl can process line directives. Using this, one can control Perl's idea of filenames and line numbers in error or warning messages (especially for strings that are processed with eval()). The syntax for this mechanism is the same as for most C preprocessors: it matches the regular expression /^#\s*line\s+(\d+)\s*(?:\s"([^"]*)")?/ with $1 being the line number for the next line, and $2 being the optional filename (specified within quotes). Here are some examples that you should be able to type into your command shell:
        and goes on to give some examples.

        -- Randal L. Schwartz, Perl hacker