PrePAN

Sign in to PrePAN

Profile

Sadrak@github

Just another Perl programmer

GitHub: Sadrak PAUSE ID: Sadrak

User's Modules

State::Tracker Manage states and execute callbacks for predefined states

= ROADMAP =

  • first oop, then overload

  • allow non binary states (dispatch internally)

= Description =

This Modul should help to manager many states in an complex environment.

You can define callbacks for all states & combinations at one place and later change only the $progress.

I use a very simple approach in an old project and i want to make a easy implementation for a new project.

The events only get fired if a related flag/counter is changed.

I am absolute unsure if there are problems with such a interface (overloading) or should i better use simple function calls ($progress->activate(PROGRESS_FIND);)?

Also the signes for setting & checks flags are my first thought, perhaps i should stick with the default binary operators (but i am most of the time confused with them).

Also i guess i need some modes:

  • What if someone registered a event with an exact counter like 10 and later increment this counter by 2 from 9 to 11. Should the event fired or not? (mode => 'singlestep')

    • Otherwise if he use exact counters, he should avoid incrementing by more than 1
  • What is someone want to disallow setting states again? Like PROGRESS_FIND is off and he set PROGRESS_FIND again to off? (mode => 'strict')

  • ggf. einen speed-mode, der davon ausgeht, das bereit nur bitfields genutzt werden?

Sadrak@github 2 comments