Sometimes I find it useful to extend one of the Jifty::Action::Record::* classes to create a new record-based action. Oddly, it seems that the most useful one is Delete, which looks a little odd:<br><br>package MyApp::Action::StartTimer;<br>
use base qw/ MyApp::Action::DeleteTimer /;<br><br>sub take_action {<br> my $self = shift;<br> $self->record->start_timer;<br>}<br><br>sub report_success {<br> my $self = shift;<br> $self->result->message(_('Started timer %1.', $self->record->name));<br>
}<br><br>It looks a little strange to create an action like this, but the way that the Delete takes a single record is exactly the right thing. I was thinking of creating a new Jifty::Action::Record like like Jifty::Action::Record::Basic or ::Simple that would be an abstract base that would merely setup the arguments in the same way as ::Delete, but does not define a take_action method. Then, after modifying the Classloader, you could change the code above to start:<br>
<br>package MyApp::Action::StartTimer;<br>
use base qw/ MyApp::Action::BasicTimer /;<br><br>Delete could then extend this as well. Is this a good idea, and anybody have a vote for a better name?<br><br>Cheers,<br>Sterling<br>