Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

OOP: How to construct multiple instances of a class at once

by DrGTO (Initiate)
on Nov 14, 2012 at 15:50 UTC ( #1003841=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    my @users;
    foreach my $id (@userIds) {
           push (@users,User->new($id));
  2. or download this
    my @users=User->new($id1,$id2,$id3,$id4);
  3. or download this
    sub new {
        my $proto = shift(@_);
        my $href = GETSQL("SELECT user_name FROM users WHERE user_id = $us
        @{$self}{keys %{$href}} = values %{$href};
            return $self;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1003841]
Approved by marto
Front-paged by Tanktalus
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-07-02 06:24 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (30 votes), past polls