[CDBI] Redefine has_many relationship

Christopher H. Laco claco at chrislaco.com
Sun Sep 18 15:18:54 BST 2005

Matt S Trout wrote:
>>Now, for the solution [for me]:
>>>   undef(*_items);
>>>   undef(*add_to__items);
>>>   __PACKAGE__->has_many(_items => $item_class, 'cart');
>>That's is the original cart class. Apparently I was trying too hard with 
>>encantations of *CustomCart::_items and $__PACKAGE__::_items...
> Kinda cute, although I worry you're not undef'ing the methods in the package
> you think you are - if it's superclass methods it's worrying about overriding
> then surely that won't clear them. Are you adding methods to the class you
> think you're adding them to?

Probably not. But it works in at least these three scenerios:

use Cart;


package CustomCart;


use CustomCart;

and that's good enough for me. :-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.digitalcraftsmen.net/mailman/private/classdbi/attachments/20050918/2c3fdc24/smime.bin

More information about the ClassDBI mailing list