Re: [CDBI] Has Many Problem
"James Hargreaves" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Awesome! Thanks fany! On 16/11/06, Martin H. Sluka <[email protected]> wrote: > Oliver Jeeves wrote: > > James Hargreaves wrote: > > > sub fixtures > > { > > my $self = shift; > > my %fixtures = map {$_ => 1} > > ($self->home_fixtures, $self->away_fixtures); > > > > return keys %fixtures; > > } > > > > That's just off the top of my head, I haven't tested it. > > I think this is supposed to return objects, which will by > stringyfied when used as hash keys. So I'd suggest: > > sub fixtures { > my $self = shift; > my %fixtures = map +( $_ => $_ ), > $self->home_fixtures, > $self->away_fixtures; > values %fixtures; > } > > Or: > sub fixtures { > my $self = shift; > my %seen; > grep !$seen{$_}++, > $self->home_fixtures, > $self->away_fixtures; > } > > Regards, > fany > > -- > noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - > Tel +49-911-9352-112 - Fax +49-911-9352-100 > > http://www.noris.de - The IT-Outsourcing Company > -- Bingo, bango, boshthedog.com