Tom Adamo
2006-09-05 14:27:39 UTC
I've been playing around with the interstitial method a bit and it's working
well for me. But, I've run into an issue where I need to bust out of the
steps. Has any thought been given on how to do this?
For example:
my $p = $self->interstitial(
{ message => "Doing 1st thing...",
action => sub {
$self->do_first_thing();
},
},
{ message => "Doing 2nd thing...",
action => sub {
### Something goes wrong here ....
$self->do_second_thing();
},
},
{ message => "Doing 3rd thing...",
action => sub {
$self->do_third_thing();
},
},
);
return $p if $p;
If something goes on it step 2 and I don't want to proceed to step 3, how do
I do that?
One idea I had was that the interstitial method could check the result of
the given action, and if there is a result, return it. That way my action
could return a page object and I could send the user to any page I want.
For example:
change:
if ($step >= 1 and $step <= @steps) { # we got work to do
if (defined (my $code = $steps[$step - 1]{action})) {
$code->(); # run the action
}
}
to:
if ( $step >= 1 and $step <= @steps ) { # we got work to do
if ( defined( my $code = $steps[ $step - 1 ]{action} ) ) {
my $action_result = $code->(); # run the action
if ($action_result) {
$self->CGI->delete($cip);
return $action_result;
}
}
}
Any thoughts on this?
Thanks for the help!
well for me. But, I've run into an issue where I need to bust out of the
steps. Has any thought been given on how to do this?
For example:
my $p = $self->interstitial(
{ message => "Doing 1st thing...",
action => sub {
$self->do_first_thing();
},
},
{ message => "Doing 2nd thing...",
action => sub {
### Something goes wrong here ....
$self->do_second_thing();
},
},
{ message => "Doing 3rd thing...",
action => sub {
$self->do_third_thing();
},
},
);
return $p if $p;
If something goes on it step 2 and I don't want to proceed to step 3, how do
I do that?
One idea I had was that the interstitial method could check the result of
the given action, and if there is a result, return it. That way my action
could return a page object and I could send the user to any page I want.
For example:
change:
if ($step >= 1 and $step <= @steps) { # we got work to do
if (defined (my $code = $steps[$step - 1]{action})) {
$code->(); # run the action
}
}
to:
if ( $step >= 1 and $step <= @steps ) { # we got work to do
if ( defined( my $code = $steps[ $step - 1 ]{action} ) ) {
my $action_result = $code->(); # run the action
if ($action_result) {
$self->CGI->delete($cip);
return $action_result;
}
}
}
Any thoughts on this?
Thanks for the help!
--
Tom Adamo
Tom Adamo