using Class::Struct in a module
From: Christopher J. Bottaro (cjbottaro_at_alumni.cs.utexas.edu)
Date: 08/05/04
- Next message: John W. Krahn: "Re: question"
- Previous message: Gunnar Hjalmarsson: "Re: question"
- Next in thread: Christopher J. Bottaro: "RE: using Class::Struct in a module"
- Maybe reply: Christopher J. Bottaro: "RE: using Class::Struct in a module"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: Wed, 04 Aug 2004 17:35:29 -0500
package My::Module;
use Class::Struct;
struct Blah => {
field1 => '$',
field2 => '$'
};
sub new {
# normal constructor
}
sub f {
my $s = new Blah; # this calls new() defined above
$s->field1 = 1;
$s->field2 = 2;
return $s;
}
package main;
my $obj = new My::Module;
my $s = $obj->f();
print "$s->field1\n$s->field2\n";
---------------------------------------------
ok, the problem is that in My::Module::f(), the statement my '$s = new Blah'
calls My::Module::new() instead of constructing a struct of type Blah. how
can i get this code to perform the way i want?
thank you for the help.
- Next message: John W. Krahn: "Re: question"
- Previous message: Gunnar Hjalmarsson: "Re: question"
- Next in thread: Christopher J. Bottaro: "RE: using Class::Struct in a module"
- Maybe reply: Christopher J. Bottaro: "RE: using Class::Struct in a module"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|