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.


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


Reply via email to