[CDBI] Has Many Problem

James Hargreaves james.hargreaves at gmail.com
Thu Nov 16 17:31:44 GMT 2006


Awesome! Thanks fany!

On 16/11/06, Martin H. Sluka <fany+perl.class-dbi at noris.net> 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



More information about the ClassDBI mailing list