In perl, methods are always called with either a class or an object as its first parameter, usually by writing:
$class_or_object->method(other arguments);
$class_or_object here can be a real object (an instance of a a class) or a class name (IOW, a string containing the package name designating the class), or a class name as a bare word.

Note the -> arrow. That means that the function is going to be looked up and called as a method. If you call the function directly, as in MyPackage::some_method() the call will not behave as a method but just like a plain function call. In other words; perl distinguishes between methods and functions only by the way they are called.

To answer your question directly: feat->mymethod() should work.

Note that more-or-less officially, all-lowercase module/package names are reserved for pragmas, which are very uncommon outside the base distribution, so while nothing aside from a potential clash with an existing pragma will stop you from using all-lowercase names, it's generally frowned upon. It also makes it harder to spot class names.


In reply to Re: package & class problem by Joost
in thread package & class problem by isha

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.