Hi,
Howdy.
please can somebody help me and show me the way to access the single attributes for my object...?
I'll try.
I do not have any clue how to handle the array in a hash and so on.
You my see a lot of benefit looking over some Perl Object documentation.
If u want to ask me why I am using it, also I cannot handle it....do not ask...now really I want to use this structure cause it represents to original datarelationship.
But I would be happy for any help provided by u.
Here is my code example: sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = { Name => undef, URLS => [], Switch => undef, CodeLine => [ CodeLineName => undef, Project => [ ProjectURL => undef, ProjectName =>undef, Logfile =>undef ] ] }; bless($self, $class); # but see below return $self; }
Let's simplify that a bit:
sub new { my $class = shift; my $self = { Name => undef, URLS => [], Switch => undef, CodeLine => [ CodeLineName => undef, Project => [ ProjectURL => undef, ProjectName =>undef, Logfile =>undef ] ] }; return bless $self, $class; }
# below is a sample accessor method which can get or set Name
sub name { my $shelf = shift; $self->{Name} = shift if @_; return $self->{Name}; }
On a side note, all your nested array references look like you meant them to be hashes. If you did, you'll want to change the [ ]s to { }s in the constructor.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>