You've managed to sidetrack most people with the mention of "predeclare". What you really want to know is "Can you pass arguments to a method without using parens?" The answer is "no".

At least part of the reason that the answer is "no" is that, in Perl5, methods are often used as accessors for member variables so it is convenient to write:

$width= $obj->width; $width= $obj->right - $obj->left;
without needing parens. So we can't make that last line start parsing as: $width= $obj->right( - $obj->left ); But you'd like to have that as an option. Well, we can consider making that option apply to a scope (like use strict), to a class, to an object, or to a method. But this option has to be determined at compile time otherwise we wouldn't be able to compile our example line. And Perl does late binding so we can't determine the class, object, nor method at compile time (we can often determine the method name at compile time but we can't determine what class it belongs to and making all methods named "size" not require parens no matter what class they are for just doesn't make much sense). So the only possibility would be to make this option apply to a given scope.

So now you can start working on that patch to add a new "compiler hint" bit to implement this. (:

        - tye (but my friends call me "Tye")

In reply to (tye)Re: Can One Predeclare a Package's Methods? by tye
in thread Can One Predeclare a Package's Methods? by sierrathedog04

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.