in reply to Re: I would have expected a syntax error here
in thread Solved! I would have expected a syntax error here

To elabotate further:

the odd words to today are considered packages, the even ones got here methods.

Both are not required to exist at compile time.

It's a variation of new Class arg-list just twice.

Hence got To (here Today () ) (capitalizing classes for clarity)

Nb: If the bare words where already pre defined subs, Perl would parse them differently.

I see two solutions:

the latter could be implemented right away.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^3: I would have expected a syntax error here
by Corion (Patriarch) on Oct 19, 2018 at 17:37 UTC

    indirect already exists on CPAN:

    >perl -M-indirect -wle "got to here today! (20180520)" Indirect call of method "here" on object "today" at -e line 1. Indirect call of method "got" on object "to" at -e line 1. Can't locate object method "here" via package "today" (perhaps you for +got to load "today"?) at -e line 1.
    >perl -wle "got to here today! (20180520)" Can't locate object method "here" via package "today" (perhaps you for +got to load "today"?) at -e line 1.

    You can put it either into PERL5OPT or just at the top of your code:

    no indirect;

      Corion:

      While I'm going to try to use the yadda operator, I think I'll stick this in my PERL5OPT since:

      1. I'm already using PERL5OPT,
      2. who knows how many of these bombs may be ticking on my hard drive, and
      3. I don't know how long it'll take me to get into the habit of using ...

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

      Nice ...

      ... but I think it should allow to add new as exception. (couldn't find it)

      There is far too much legacy code using an indirect new as constructor.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        You don't need to make it fatal and you also don't need to enable it globally.

        If it is for your own code, you can slowly fix that code, eliminating those warnings.