Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

1. Perl Pocket Reference > Object-Oriented Programming

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.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint