Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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
    +erId");
        @{$self}{keys %{$href}} = values %{$href};
            return $self;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2014-08-01 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (11 votes), past polls