in reply to Re: Simple OO
in thread Simple OO

Without the use statement I get:
No such class wolf at demo.pl line 22, near "my wolf" syntax error at demo.pl line 22, near "my wolf="

Replies are listed 'Best First'.
Re: Re: Re: Simple OO
by Kanji (Parson) on Feb 12, 2002 at 07:08 UTC

    You're missing some $'s ...

    my $wolf=new sheep;
    print $wolf->bleet()."\n";

        --k.


      This, and you need ref($proto) not ref{$proto} (parentheses not braces).

Re: Re: Re: Simple OO
by dws (Chancellor) on Feb 12, 2002 at 07:08 UTC
    Without the use statement I get:
    No such class wolf at demo.pl line 22, near "my wolf" syntax error at demo.pl line 22, near "my wolf="
    The reason for this error message is a bit more obscure. (It has to do with something called "indirect object syntax".) However, the error goes away if turn the bareword wolf into the scalar $wolf.
    my $wolf=new sheep; ^
    I suspect this is what you had in mind.

      Obviously my brain is feeling unpunctuated today. Thank you all for the $help. Sorry to be a pain but any ideas on why I get a
      Can't locate object method "bleet" via package "HASH" at demo.pl line +23.
      ? (Is this my cargo finally coming home?)
        ...any ideas on why I get...

        See Kanji's earlier response.

        ? (Is this my cargo finally coming home?)

        Perl requires a certain eye to punctuation. For a free language, it is surprisingly insistent on seeing dollar signs in the right places.