how to loop over instances of a class

Discussion in 'Perl Misc' started by fulko.hew@sita.aero, Jan 30, 2004.

  1. Guest

    There has got to be a built in way to loop over all instances of a class.
    But I can't find it.

    ie.

    foreach $y (MYCLASS::) {
    $y->mymethod();
    }
     
    , Jan 30, 2004
    #1
    1. Advertising

  2. Jay Tilton Guest

    wrote:

    : There has got to be a built in way to loop over all instances of a class.

    What have you read that makes you believe that?
     
    Jay Tilton, Jan 30, 2004
    #2
    1. Advertising

  3. "Jeff Thies" <> writes:

    > > There has got to be a built in way to loop over all instances of a class.
    > > But I can't find it.

    >
    > Personally, I push a reference to it on an array.


    Yep, and don't forget to Scalar::Util::weaken() it.

    --
    \\ ( )
    . _\\__[oo
    .__/ \\ /\@
    . l___\\
    # ll l\\
    ###LL LL\\
     
    Brian McCauley, Jan 31, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samuel Stammbach
    Replies:
    0
    Views:
    713
    Samuel Stammbach
    Aug 14, 2003
  2. Replies:
    2
    Views:
    586
    iksrazal
    Feb 21, 2005
  3. John Wohlbier
    Replies:
    2
    Views:
    382
    Josiah Carlson
    Feb 22, 2004
  4. Replies:
    8
    Views:
    479
    James Stroud
    Jan 29, 2009
  5. Isaac Won
    Replies:
    9
    Views:
    405
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page