Re: Vague thoughts about is_a and might_be relationships

[prev] [thread] [next] [Date index for 2004/08/19]

From: Aaron Trevena
Subject: Re: Vague thoughts about is_a and might_be relationships
Date: 11:58 on 19 Aug 2004
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@xxxxxxxxx.xxx.xxxxxxxxxx.xxx for more info.

--0-1474383814-1092916710=:9178
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Wed, 18 Aug 2004, Tom Hukins wrote:
> I've been thinking about how Class::DBI might work with table
> inheritance recently and briefly experimented with writing a custom
> relationship for this.

Cool.

I have a very short Class::DBI::Relationship::IsA module that Richard
Hundt wrote but isn't on CPAN. It seems to work when he used it but I
haven't used it in anger yet. It is attached, but I haven't tested (or
even compiled it). usual disclaimers and caveats apply :)

Right now he is on holiday in South Africa but he gets back we plan to
work together on some more relationships and attribute types and get them
onto CPAN. Any feedback or suggestions appreciated.

cheers,

A.

        -- 
        Aaron J Trevena - Perl Hacker, Kung Fu Geek, Internet Consultant
AutoDia --- Automatic UML and HTML Specifications from Perl, C++
and Any Datasource with a Handler.     http://droogs.org/autodia
--0-1474383814-1092916710=:9178
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="IsA.pm"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.NEB.4.56.0408191258300.9178@xxxx.xxxxxxx.xxx.xx>
Content-Description: IsA.pm
Content-Disposition: attachment; filename="IsA.pm"

cGFja2FnZSBDbGFzczo6REJJOjpSZWxhdGlvbnNoaXA6OklzQTsNCg0KPWhl
YWQxIE5BTUUNCg0KQ2xhc3M6OkRCSTo6UmVsYXRpb25zaGlwOjpJc0EgLSBB
IENsYXNzOjpEQkkgbW9kdWxlIGZvciAnSXMgQScgcmVsYXRpb25zaGlwcw0K
DQo9aGVhZDEgREVTQ1JJUFRJT04NCg0KUHJvdmlkZXMgYW4gSXMgQSByZWxh
dGlvbnNoaXAgYmV0d2VlbiBDbGFzczo6REJJIGNsYXNzZX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MjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDQojIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIw0KDQoxOw0KDQo=

--0-1474383814-1092916710=:9178--

Re: Vague thoughts about is_a and might_be relationships
Aaron Trevena 11:58 on 19 Aug 2004

is_a relationship?
Caroline Johnston 14:14 on 27 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52