On 6/11/07, Robert Hicks <[EMAIL PROTECTED]> wrote:
Dr.Ruud wrote: > "Adriano Ferreira" schreef: > >> Definitely go with >> my $test = Some::Module->new; > > or even with: > my $test = Some::Module::->new(); > While I am sure that will work...I have never seen it with parens after the new.
As the docs say, there is nothing special about C< new >. It is only a convention that it is the usual named used for a constructor. As any other methods without arguments, it can be invoked as Some::Module->new or Some::Module->new() But on the hand, it the constructor has parameters, you will forcefully need the parameters Some::Module->new($arg1, $arg2) because Some::Module->new $arg1, $arg2 (or something like that) is illegal. This is different from subroutines invoked without parentheses around their arguments (which are legal if the sub definition was seen before so that the interpreter knows it refers to code). But that has to do with requirements of Perl syntax. Cheers, Adriano Ferreira.
Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/