in reply to How to use a list of structs that contain a list of structs?
The documentation says:
Giving a struct element a class type that is also a struct is how structs are nested. Here, timeval represents a time (seconds and microseconds), and rusage has two elements, each of which is of type timeval.
start_update:use Class::Struct; struct( rusage => { ru_utime => timeval, # seconds ru_stime => timeval, # microseconds }); struct( timeval => [ tv_secs => '$', tv_usecs => '$', ]);
end_update:# create an object: my $t = new rusage; # $t->ru_utime and $t->ru_stime are objects of type timeval. # set $t->ru_utime to 100.0 sec and $t->ru_stime to 5.0 sec. $t->ru_utime->tv_secs(100); $t->ru_utime->tv_usecs(0); $t->ru_stime->tv_secs(5); $t->ru_stime->tv_usecs(0);
You're missing the parentheses.
And as for emailing you our responses, an email address would be useful. The one you entered when you registered is kept private.
As for adamsj's comment, I think a /msg should've sufficed.
"cRaZy is co01, but sometimes cRaZy is cRaZy".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: How to use a list of structs that contain a list of structs?
by Fastolfe (Vicar) on Sep 18, 2000 at 05:54 UTC |