[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] remove duplicate callbacks? (was: Re: Yet another callback system proposal)


On 2005-05-25, Michael Graham <suppressed> wrote:
>
>> I'd feel comfortable releasing this.
>>
>> Feedback from others?
>
> One thing I didn't take into account with my patch (and which has been
> bugging me) is that duplicate hooks aren't filtered out.
>
> So for instance:
>
>     CGI::Application
>         My::Project        # uses Plugin::A
>             My::App        # uses Plugin::A again
>
> This would cause the callbacks registered by Plugin::A to be run twice.
>
> When I wrote the patch, I sort of filed this situation under "don't do
> that."  But now I'm wondering if maybe the callback system should remove
> duplicates?

Thanks for mentiong this. 

I think it should.

Consider this case:

Two packaged plugins both use a third database plugin with a database
setup routine that happens automatically by a hook.

It would be undesirable to all it twice.

The other alternative would be for every plugin to handle the case of
whether or not it has been accidently called twice. That seems like a
hassle.

If you want something tu run twice, that can be expressed explicitly by
calling a function directly.

    Mark

--
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   suppressed     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.