The thing is, at some point you're going to have to code the 'what happens next' process. It may make sense though to add a
do_next_thing method to your state class and then write:
sub TicketState::New::next_action { 'send_ticket_to_supervisor' }
sub TicketState::Pending::next_action { 'send_to_editorial_group' }
sub TicketState::do_next_thing {
my $self = shift;
my $action = $self->next_action;
$self->$action(@_);
}
By doing things this way you get to give meaningful names to the individual actions handled by a state, but still have a simple dispatch system that simply calls
$ticket->do_next_action on every ticket it dispatches.
If you're using the state simply to control the flow of an object through a system and you've not got other state dependent behaviour then you can probably get away with having a single state class and a handy dandy config file but I don't think I'd recommend starting out with one.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.