Re: [CDBI] Has Many Problem

"Martin H. Sluka" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.