in reply to defclass and defmethod

That's not valid Perl syntax. If you can run this, you're probably using a Source Filter. Source filters are modules that generate Perl code from non-Perl files before Perl sees it.