Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 rifling through the Monastery: (4)
As of 2015-07-05 22:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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









    Results (68 votes), past polls