For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > A doubt in using Class::Struct









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author A doubt in using Class::Struct
None

2006-10-05, 6:58 pm

Hello,

I am trying to use Class::Struct, for creating a structure as follows:

package Classes;
use Class::Struct;
struct(messages => '@');

$msg = new Classes;
push(@abc, "HELLO");
push(@abc, "WORLD");
push(@abc, "BYE");
$msg->messages(@abc);

@xyz = @{$msg->messages};
foreach $elem(@xyz)
{
print $elem ."\n";
}

This gives the following error on compilation:

Too many args to messages at (eval 1) line 17
Classes::messages('Classes=ARRAY(0x81030
84)', 'HELLO', 'WORLD',
'BYE')

Also, if I remove the third element of the array, the program compiles,
but I get the following output:
WORLD

The element "HELLO is not displayed.
Can anyone help me with this or let me know what the problem is?

Thanks,
Avi.

Paul Lalli

2006-10-05, 6:58 pm

None wrote:
> I am trying to use Class::Struct, for creating a structure as follows:


The OP multi-posted this message, and the thread has continued in CLPM
at
http://groups.google.com/group/comp...9420c1dd38841c9

To the OP, please don't do that again. If you *NEED* to post to more
than one group, please cross-post, do not multipost. That is, send one
message with all the groups in the to: line. Do not send one copy of
the message to each group individually.

Thank you.

Paul Lalli

None

2006-10-05, 6:58 pm

Okay,
I'll do that!
-Avi.

Paul Lalli wrote:
> None wrote:
>
> The OP multi-posted this message, and the thread has continued in CLPM
> at
> http://groups.google.com/group/comp...9420c1dd38841c9
>
> To the OP, please don't do that again. If you *NEED* to post to more
> than one group, please cross-post, do not multipost. That is, send one
> message with all the groups in the to: line. Do not send one copy of
> the message to each group individually.
>
> Thank you.
>
> Paul Lalli


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com