Please bottom post....

> 
> No. $self you'll usually see in a lot of Object Oriented applications.
When a 
> subroutine is called using the -> operator ($mw = MainWindow->new, for 
> example) the first arguement passed to that subroutine is the name of the 
> package/class. So, $self is usually used to display this. So, a common
constructor is
> 

"package/class" or the object instance...

> sub new {
>     my ($self, %args) = @_;
>     return bless \%args, $self;    
> }
> 
> Look into perldoc perlboot, perldoc perltoot, perldoc -f bless, etc.
Like the 
> name "new" for a constructor, you can name it anything you want, but many 
> choose to name it $self, because in a constructor it is literally the
name of 
> your own package, and otherwhere it is a hash blessed to your own
package. Hope 
> that helps.

Not necessarily a hash. For myself I prefer to use $class rather than
$self in class methods, so that I know that I am not (cannot) be working
on an instance.

http://danconia.org

> 
> 
> In a message dated 2/19/2004 11:24:11 PM Eastern Standard Time, 
> [EMAIL PROTECTED] writes:
> is $self a special scalar?
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to