Re: Perl Object Creation problem...




howa wrote:
Aukjan van Belkum 寫道:

howa wrote:

use lib "C:\\temp\\perl";

use class::user;

$u = new user();
----------------------


This should be:
$u = new class::user; (or pref.: my $u = new class::user;)
or
$u = class::user->new(); (or pref.: my $u = class::user->new();)
but is it possible to use

$u = new user;

just like in c++, i.e. using namespace std;

No, there is no such mechanism builtin[1] to Perl5. All class names
must be specified absolutely.

[1] I say builtin because it's just the sort of thing you might expect
to see in an Acme::* modules. Note Acme::* modules are only intended as
jokes.

.