L
Lin Jingxian
Hi,
I have generate some objects in one subroutine, now I pass the object array
to another subroutine, how can I access the objects.
for example:
use Class::Struct;
struct Field => {
name=>'$',
type=>'$',
};
my $field = \Field->new();
$field->name("username");
$field->type("varchar");
my @fields;
push @fields,$field;
show_field(@field);
sub show_field{
my @fields = @_;
my $field = shift @fields;
print $field->name(); ########## here I got : Can't call method
"name" on unblessed reference
print $field->type();
};
Perl don't think $field as a object, what should I do ?
thanks.
I have generate some objects in one subroutine, now I pass the object array
to another subroutine, how can I access the objects.
for example:
use Class::Struct;
struct Field => {
name=>'$',
type=>'$',
};
my $field = \Field->new();
$field->name("username");
$field->type("varchar");
my @fields;
push @fields,$field;
show_field(@field);
sub show_field{
my @fields = @_;
my $field = shift @fields;
print $field->name(); ########## here I got : Can't call method
"name" on unblessed reference
print $field->type();
};
Perl don't think $field as a object, what should I do ?
thanks.