Basic Concepts of Classes and Objects

This section describes what is a class and what is an object. Perl uses packages to simulate classes and references to simulate objects.

Class - A user defined complex data type with attributes and operations.

Object - A data instance of the data type defined by a class.

Class variable - An attribute that is shared by all objects of a class. A class variable is also called a static variable.

Object variable - An attribute that is associated with each individual object of a class. An object variable is also called an instance variable.

Class method - An operation that requires a class to be implicitly associated with. A class method is also called static method.

Object method - An operation that requires an object to be implicitly associated with. An object method is also called an instance method.

In order to use classes and objects, other languages have special syntaxes to define classes, declare objects, access attributes, and invoke operations. But Perl tries to extend the package concept to simulate class and extend the reference concept to simulate object.

Table of Contents

 About This Book

 Perl on Linux Systems

 ActivePerl on Windows Systems

 Data Types: Values and Variables

 Expressions, Operations and Simple Statements

 User Defined Subroutines

 Perl Built-in Debugger

 Name Spaces and Perl Module Files

 Symbolic (or Soft) References

 Hard References - Addresses of Memory Objects

Objects (or References) and Classes (or Packages)

Basic Concepts of Classes and Objects

 Invoking Package Subroutines as Class Methods

 bless() - Converting References to Objects

 Invoking Package Subroutines as Object Methods

 Class Variables and Object Variables

 new() Method - Creating Objects by the Class - A Perl Class Example

 Typeglob and Importing Identifiers from Other Packages

 String Built-in Functions and Performance

 File Handles and Data Input/Output

 Open Files in Binary Mode

 Open Directories and Read File Names

 File System Functions and Operations

 Converting Perl Script to Executable Binary

 Using DBM Database Files

 Using MySQL Database Server

 Socket Communication Over the Internet

 XML::Simple Module - XML Parser and Generator

 XML Communication Model

 SOAP::Lite - SOAP Server-Client Communication Module

 Perl Programs as IIS Server CGI Scripts

 CGI (Common Gateway Interface)

 XML-RPC - Remote Procedure Call with XML and HTTP

 RPC::XML - Perl Implementation of XML-RPC

 Integrating Perl with Apache Web Server Module for Building Web Pages

 LWP::UserAgent and Web Site Testing


 PDF Printing Version