yoda54 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use User; my $test = User->new(name => "user1", team=> "teamalpha"); my $test2 = User->new(name => "user2", team=> "teambeta"); $test->test(); $test2->test(); package User; use strict; use warnings; my $references; sub new { my ($class, %arg) = @_; my $objref = { _name => $arg{name} || "unknow +n" _team => $arg{team} || "unknow +n" }; bless $objref, $class; $references->{$objref} = "value"; return $objref; } sub test { my $self = shift @_; foreach my $object (keys %$ds) { if($self->{_team} ne $object->{_team}) { #find opposing team #do something to $object } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl OO - Class Data
by Tanktalus (Canon) on Jun 26, 2006 at 16:11 UTC | |
by dsheroh (Monsignor) on Jun 26, 2006 at 16:50 UTC | |
by yoda54 (Monk) on Jun 26, 2006 at 19:14 UTC | |
|
Re: Perl OO - Class Data
by Moron (Curate) on Jun 26, 2006 at 16:52 UTC | |
|
Re: Perl OO - Class Data
by japhy (Canon) on Jun 26, 2006 at 15:50 UTC | |
|
Re: Perl OO - Class Data
by NetWallah (Canon) on Jun 26, 2006 at 16:03 UTC | |
by ikegami (Patriarch) on Jun 26, 2006 at 17:47 UTC | |
|
Re: Perl OO - Class Data
by eric256 (Parson) on Jun 26, 2006 at 19:50 UTC |