Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Steve Coleman - SEWP <scoleman at sewp dot nasa dot gov>
Subject: Re: Beginners Question
Date: Mar 15 1996 2:23PM

Excerpts from what Steve Chowles said:

 |Hi there
 |I have been using Perl now for two weeks and Sybperl for one and I am 
actually having success.  I have looked at the man pages bu
 |t I am still unsure of the following :-
 |1. I have seen the statement 'my $self = shift',  what does the 'my' do?

In perl5 using object oriented techniques,  each method of an object class 
(or perl5 package) must know what object instance is being operated on by 
that method.  To do this, when using $object->method() syntax, perl5 will
implicitly pass the object itself at the first argument to that method.

 $object = new OBJECTCLASS;

can be re-written as:

 $object = new OBJECTCLASS;

After the '$self = shift;' statement the method will be able to inspect the 
values within that object (using $self) and call other methods defined by 
the classes package.

 |2. What is the difference between the following and which one should I use? -
 |   $d->dbcmd(....... and $d=&dbcmd(.......

$d->dbcmd() is an object invoking a method function within the package that
defined that object (or inherited from another base class).

$d=&dbcmd() is a function defined within the main module being called and 
returning its results into variable $d.

 |3. What does 'use sybase::DBlib' mean

Sybase::DBlib is the perl5 'package' name that contains the code necessary to
use the sybase DBlib extensions created by our heroic idol Michael Pepper 
(applause...).  The use statement says to find the package '' in
the installed perl 'Sybase' lib directory path (see @INC for details).

Good luck;

Steve Coleman          --
vox: 301.286.7636         fax: 301.286.1619