Paul Lalli schreef:
> Dr.Ruud:
>> Adriano Ferreira:

>>> Definitely go with
>>>  my $test = Some::Module->new;
>>
>> or even with:
>>    my $test = Some::Module::->new();
>
> For the love of $DEITY, why?

<quote src="Johan Vromans">

If you use A::B::->new();
you'll get a compile time check on whether module A::B is loaded as a
bonus.

</quote>


<quote src="Elizabeth Mattijsen">

$ perl -wc -e 'Foo->new'
-e syntax OK

$ perl -wc -e 'Foo::->new'
Bareword "Foo::" refers to nonexistent package at -e line 1.
-e syntax OK

$perl -wc -e '$Foo::a = 1; Foo::->new'
Name "Foo::a" used only once: possible typo at -e line 1.
-e syntax OK

So the bonus is not about that the module is loaded, but about the
existence of the namespace.
You need to check %INC to find out whether the system thinks that the
module is loaded.

</quote>

-- 
Affijn, Ruud

"Gewoon is een tijger."


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


Reply via email to