[CDBI] Adding metadata to objects

[prev] [thread] [next] [Date index for 2005/09/27]

From: Bill Moseley
Subject: [CDBI] Adding metadata to objects
Date: 19:42 on 27 Sep 2005
Does CDBI provide a way to add meta data to object instances?

I want to generate a list of CDs, say limited to a given genre.  So
using Catalyst in this example, in the controller I might say:

    $c->stash->{items} = Music::CD->search( { genre => 'Rock' } );

Now in the template I want to list the CDs, and also list the tracks
on the CD:

    WHILE (item = items.next);
        "Title = "; item.title;

        # list tracks
        tracks = item.tracks;
        WHILE (track = tracks.next);
            "* Track "; track.title;
        END;
    END;

Here's the question:  assume that the CD has an overall genre, but
also each *individual* track also has a genre and I only want to list
tracks that have a genre that matches the genre used for the original
query on the CDs.

So above the "tracks = item.tracks" would only return tracks that also
have genre = 'Rock'.

So, what I want to do is add "genre => 'Rock'" as meta data to each CD
instance, and then when calling "tracks" on a CD have that method use
that genre in the query.


        -- 
        Bill Moseley
moseley@xxxx.xxx


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Adding metadata to objects
Bill Moseley 19:42 on 27 Sep 2005

Re: [CDBI] Adding metadata to objects
Kingsley Kerce 20:17 on 27 Sep 2005

Re: [CDBI] Adding metadata to objects
Bill Moseley 20:42 on 27 Sep 2005

Re: [CDBI] Adding metadata to objects
Wayne Walker 21:10 on 27 Sep 2005

Re: [CDBI] Adding metadata to objects
Peter Speltz 21:46 on 27 Sep 2005

Re: [CDBI] Adding metadata to objects
Kingsley Kerce 01:00 on 28 Sep 2005

Generated at 10:29 on 10 Oct 2005 by mariachi v0.52