in reply to object contstruction

  1. You have Module::Test inheriting from itself. This is clearly wrong. Omit the line
    our @ISA = qw ( Module::Test );
  2. The following line is where your error is:
    my $self = Module::$t->new;
    I'm trying to understand what you are attempting to do here. You are wanting to call the constructor of some other class in some other Module:xxx namespace, and you are then blessing this into your passed classname.

    This is syntactically invalid, and also breaks strict 'refs', or rather would bresk it if you specified

    my $self = ${"Module::$t"}->new;
I suggest you familiarise yourself with perl OO, by reading the documentation: perldoc perlobj and perlboot. Also, get hold of a copy of "Learning Perl" or "Programming Perl", as these books provide the details in dead tree form.

--
I'm Not Just Another Perl Hacker

Replies are listed 'Best First'.
Re^2: object contstruction
by ysth (Canon) on Dec 14, 2004 at 10:36 UTC
    You have Module::Test inheriting from itself.
    Incorrect. Look again.
    The following line is where your error is:
    my $self = Module::$t->new;
    I'm trying to understand what you are attempting to do here. You are wanting to call the constructor of some other class in some other Module:xxx namespace, and you are then blessing this into your passed classname.

    This is syntactically invalid, and also breaks strict 'refs', or rather would bresk it if you specified

    my $self = ${"Module::$t"}->new;
    That's not right. It's perfectly legal (even under strict) to use interpolated strings as package names: "M::$t"->new. Your suggestion would look for a variable named $Module::Test and call new in the package or for the object contained in that variable, which is clearly not what the OP is trying to do.