O'Reilly logo

Perl Pocket Reference, 5th Edition by Johan Vromans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Object-Oriented Programming

An object is a referent that knows which class it belongs to.

A class is a package that provides methods. If a package fails to provide a method, the base classes as listed in @ISA are searched, depth first.

A method is a subroutine that expects an invocant (an object reference or, for static methods, a package name) as the first argument.

bless ref [ , classname ]

Turns the referent ref into an object in classname (default is the current package). Returns the reference.

invocant->method [ ( parameters ) ]

Calls the named method.

method invocant [ parameters ]

Provides an alternative way of calling a method, using the sometimes ambiguous indirect object syntax.

See also ref (page 63), and the next section.

perlobj, perlboot, perltoot, perltooc.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required