Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

dispatch plugin, then run code inside script?

Quote Reply
dispatch plugin, then run code inside script?
hi guys,

Can anyone show me how you use the dispatch plugin feature and run code below it rather than specifying a class method to run/jump to?

So for eg. instead of...

Code:
if ($PLG->dispatch('check_request', \&Links::check_request)) {
$PLG->dispatch('handle_modify', \&Links::User::Modify::handle);
}

which jumps to a class after dispatching the plugin, instead do something like...

Code:
if ($PLG->dispatch('check_request', \&Links::check_request)) {
if ($PLG->dispatch('handle_modify') {
RUN THE CODE THAT'S HERE
}
}

which means the actual code for that script is located IN that script, rather than in another external class.

regan
Quote Reply
Re: [ryel01] dispatch plugin, then run code inside script? In reply to
Code:
$PLG->dispatch('handle_modify', sub {
# your code here
});

Adrian