in reply to Class::Multimethods namespace collusion

How would you solve this?

Not have the object constructor as a multi-method?

Can you explain in more detail what the problem that you're trying to solve by having new() as a multi-method is? It's not clear from your example.

  • Comment on Re: Class::Multimethods namespace collusion

Replies are listed 'Best First'.
Re: Re: Class::Multimethods namespace collusion
by bakunin (Scribe) on Feb 17, 2004 at 09:30 UTC
    Thanks for replying. Let me try to paraphrase:

    ## FOR ILLUSTRATION PURPOSES, code below will not run!! use strict; use SWFAuto::Button; use SWFAuto::Text; my $buttonA = SWFAuto::Button->new(); my $buttonB = SWFAuto::Button->new("I'm a button"); my $textA = SWFAuto::Text->new(); my $textB = SWFAuto::Text->new("I'm a text"); ## SWFAuto::Text::new is called 4 times!

    Basically this is the usage of the modules. The constructor "new" is overloaded in both classes. And, both have the same argument lists. And then whichever you "use Module;" last, its constructor gets called.

    Well, at least the typeglob came very handy this time for me!