in reply to Re^2: require at compile time?
in thread require at compile time?

Regardless of the state of the guts, I guess that the question is: Why is the statement require URI;, which is executed after the print (and, more importantly, the defined test), changing the result of it? It must be that something in the mere compilation of require URI; is changing the execution of the rest of the program, right?

I originally thought that it must be that the act of compilation creates the glob for future reference, but you say that this is not so. How do you use exists to test for the existence of a glob? (Is that what you're doing in Re^2: require at compile time? below?) According to the documentation, it can only be used on hash or array lookups, or subroutine names.

Replies are listed 'Best First'.
Re^4: require at compile time? (hint)
by tye (Sage) on Nov 07, 2008 at 17:28 UTC

    As I recall, it has long been the case that 'require URI;' has had a subtle compile-time impact in trying to disambiguate certain ambiguous syntax. But I don't know if the behavior change that you noticed was more due to this DWIM hint being changed or the mis-use of defined being changed (I am unaware of changes to either but my guess is that one of those likely changed).

    - tye        

Re^4: require at compile time?
by ikegami (Patriarch) on Nov 07, 2008 at 20:23 UTC
    I forgot the bit about how appending require URI; changes the result. I struck out my earlier statement. As you can see, require URI; does have a compile-time effect on the symbol table:
    >perl -le"print for grep /::$/, keys %::" ... Internals:: DB:: >perl -le"print for grep /::$/, keys %::; require URI;" ... Internals:: DB:: URI::
      Thanks—that's extremely clear. I still don't understand your remaining statement in Re^2: require at compile time?, that exists contradicts the statement “The glob exists”, though. (I don't disagree—I just don't understand it.)

        That statement is also wrong. Same reason.

        >perl588\bin\perl -le"print exists $::{'URI::'} ? 'yes' : 'no';" no >perl5100\bin\perl -le"print exists $::{'URI::'} ? 'yes' : 'no';" no >perl588\bin\perl -le"print exists $::{'URI::'} ? 'yes' : 'no'; requir +e URI;" yes >perl5100\bin\perl -le"print exists $::{'URI::'} ? 'yes' : 'no'; requi +re URI;" yes