Read through his code and error message again. hackdaddy already has $AUTOLOAD declared properly, otherwise the first method call would fail, but according to hackdaddy, it's successful. However, read through the text of the actual error message.

Can't use string ("WM::Install::Table::ArchiveTbl") as a HASH ref whil +e "strict refs" in use at /u08/pkg/wms/wmcmtools/modules/WM/Install/Table/ArchiveTbl.pm line +192.

Now look at first few lines of the autoload.

sub AUTOLOAD { my ($self, $newval) = @_; $AUTOLOAD =~ /.*::get(_\w+)/ and $self->_accessible($1) and return $self->{$1};

As you can see, the return statement (return $self->{$1}) is attempting to use $self as a hashref. Since the error messsage shows that the programmers is trying to use the package name as a hashref, we clearly have the package name and not the object being passed as the first argument to AUTOLOAD. I was using a generic constructor to illustrate how the first argument could be a package name instead of an object, as expected.

Cheers,
Ovid

PS: I'm also a Terry Pratchett fan (I'm assuming that's what your nick refers to).

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re(3): Autoload'ed class method calls by Ovid
in thread Autoload'ed class method calls by hackdaddy

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.