Re: What is 'new' doing?



Thanks!

Mathew

Adriano Rodrigues wrote:
On 11/22/06, Mathew Snyder <theillien@xxxxxxxxx> wrote:
In this line of code what is 'new' doing?
my $users = new RT::Users(RT::SystemUser);

Mathew,

This is called the indirect object notation. It is invoking the method
'new' of the package 'RT::Users', with arguments ( RT::SystemUser ).

It is not recommended anymore. Most code today uses the
straightforward and unambiguous construction

my $users = RT::Users->new(RT::SystemUser);

See this link

http://perldoc.perl.org/perlobj.html#Indirect-Object-Syntax-indirect-object-syntax-invocation%2c-indirect-indirect


or look for the section "Indirect Object Syntax" on perldoc perlobj.

Regards,
Adriano Ferreira.

.