RE: What is 'new' doing?
- From: t.baetzler@xxxxxxxxxx (T Baetzler)
- Date: Wed, 22 Nov 2006 10:56:53 +0100
Mathew Snyder <theillien@xxxxxxxxx> asked:
In this line of code what is 'new' doing?
my $users = new RT::Users(RT::SystemUser);
It's trying to look like a Perl built-in when
in fact it's just a method of the RT::Users
class.The above code is equivalent to writing
my $users = RT::Users->new(RT::SystemUser);
i.e. call the method new() of the class RT::Users
with an argument of RT::SystemUser.
The important thing here is to realize that
in Perl, you can call your constructor whatever
you like - though it's a nice gesture to stick
to open standards like using "new" for it ;-) -
and that you have two equivalent notations for
method calls.
HTH,
Thomas
.
- Prev by Date: Re: How to make a perl program to an exe file
- Next by Date: Re: What is 'new' doing?
- Previous by thread: Re: What is 'new' doing?
- Next by thread: RE: How to make a perl program to an exe file (U)
- Index(es):