|more useful options|
My Problem: I've got several classes, looking a little bit like this:
App | App::Basic / \ App::Basic::Special1 App::Basic::Special2 | | | | | My::App | | / \ | My::App::Special1 My::App::Special2Note that My::App doesn't inherit from App. And note that there are My::OtherApp, Your::App too, looking like My::App and inheriting from App::*
Each of this Classes contains some config values as Class Data.
I want to be able to fetch all those config values, merge them and do something with the result.
E.g.: Say, each class contains an array called @order and a hash called %lables.
Each Class now defines some of those values. Some Classes append new values to @order and %lables, some overwrite data in %lables.
There are some basic fields (used everywhere in the app) defined in App::Basic. Each App::Basic::Special1/2 adds some fields unique to this special case.
Now, My::App changes some field lables (e.g. use another language). My::App::Special1 may add even more fields that are only needed in My::App (there might be a My::OtherApp::Special1 that inherits from App::Basic::Special1 and doesn't use this fields)
Then I call dispatch_to_all('get_fields') which fetches all those @field arrays, massage the returned array of all return values to fit my needs, and voila: I get the array of fields used by this Class, without having to specify the "Basic" fields in all Subclasses (which would result in a lot of typing and and even bigger lot of problems should I need to change a App::Basic config value)
This was/is my problem, and that's why I wrote Class::DispatchToAll, which seems the best way to solve this problem to me. But if you now another way, please let me know...