in reply to difference b/w API and a class

API - Application Program Interface. A general term meaning the way that a program uses a functional library. Usually that is through function/subroutine calls. A Perl API is just an API available for Perl programs to use. The Perl API is the API available for other programs to call and invoke Perl. In this case it means a low-level interface generally called from C.

A Class is a description of a type. It can include an API, in that a program can invoke operations on members of the class (methods on objects), but a Class is much more than just an API. It includes the description of the data. For example, a Class of Car will describe the operations you can do on a car (start the engine, operate the brake, etc.) but also its identity (chassic number, registration number), it's colour, and so on. It may also own objects of other classes: 4 wheels, an engine, gearbox, and so on.

Simplistically, in classic Perl terms, a Class consists of subroutines (the API) and attributes (data). Moose extends this to include other concepts such as roles and delegation.