Professional Web Applications Themes

Array of objects - PERL Beginners

Hi , I have to store list of objects in Array. At the end, arr contains n copies of last $obj, but not every $obj created. I tried storing both object, ref of object. Array contains different references, but same data. Please help. thanks, Jay the current code looks like this : $n=0; my arr=(); while ( results ) { $n++; my $obj = RowClass->new(); .... .... push arr, $obj; }...

  1. #1

    Default Array of objects

    Hi ,
    I have to store list of objects in Array. At the end, arr contains n copies of last $obj, but not every $obj created.
    I tried storing both object, ref of object. Array contains different references, but same data. Please help.
    thanks,
    Jay

    the current code looks like this :

    $n=0;
    my arr=();
    while ( results )
    {
    $n++;
    my $obj = RowClass->new();
    ....
    ....

    push arr, $obj;
    }
    Jayakumar Guest

  2. #2

    Default Re: Array of objects

    Jayakumar Rajagopal wrote: 


    OK, this URL is not your question, but it may help you understand your
    situation better :)


    http://search.cpan.org/~lbrocard/perl5.005_04/lib/Symbol.pm

    -Bill-
    __Sx__________________________________________
    http://youve-reached-the.endoftheinternet.org/
    Wc Guest

  3. #3

    Default RE: Array of objects

    Jayakumar Rajagopal wrote: 

    each call to RowClass::new should be returning a unique bless()'d reference.
    If that's the case, the rest of your code looks fine. What is
    RowClass::new() doing?
    Bob Guest

  4. #4

    Default RE: Array of objects

    Bob,
    Thanks. Already I have been working out on the same row. I think I misunderstood significance of self reference, which is first parameter of methods. After finishing I would mail.
    regards,
    Jay

    -----Original Message-----
    From: Bob Showalter [mailto:com]
    Sent: Thursday, March 04, 2004 1:38 PM
    To: Jayakumar Rajagopal; org
    Subject: RE: Array of objects


    Jayakumar Rajagopal wrote: 

    each call to RowClass::new should be returning a unique bless()'d reference.
    If that's the case, the rest of your code looks fine. What is
    RowClass::new() doing?
    Jayakumar Guest

  5. #5

    Default RE: Array of objects

    Bob,
    Your guess is perfect. Thanks a lot.
    All the problems happened due to misunderstanding of class behaviour. ( new() and get() functions).
    cheers,
    Jay

    -----Original Message-----
    From: Bob Showalter [mailto:com]
    Sent: Thursday, March 04, 2004 1:38 PM
    To: Jayakumar Rajagopal; org
    Subject: RE: Array of objects


    Jayakumar Rajagopal wrote: 

    each call to RowClass::new should be returning a unique bless()'d reference.
    If that's the case, the rest of your code looks fine. What is
    RowClass::new() doing?
    Jayakumar Guest

Similar Threads

  1. Array out of Objects
    By rakmaster in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: May 13th, 03:18 AM
  2. How to get an OLE array of objects?
    By kingskippus@gmail.com in forum PERL Modules
    Replies: 2
    Last Post: August 18th, 05:49 PM
  3. How to represent an array of objects?
    By Mark A. Deal in forum ASP.NET Web Services
    Replies: 1
    Last Post: January 11th, 01:11 AM
  4. array of objects
    By jeclark3 in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 15th, 11:09 PM
  5. What is this objects name in the array?!
    By equinox007 webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: January 13th, 06:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139