GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CONTINUITY::REQUESTCALLBACKS (3)

.ds Aq ’

NAME

Continuity::RequestCallbacks - Mix callbacks into the Continuity request object

CONTENTS

SYNOPSYS



  use Continuity;
  use Continuity::RequestCallbacks;

  Continuity->new->loop;

  sub main {
    my $request = shift;
    my $link_yes = $request->callback_link( Yes => sub {
      $request->print("You said yes! (please reload)");
      $request->next;
    });
    my $link_no = $request->callback_link( No => sub {
      $request->print("You said no! (please reload)");
      $request->next;
    });
    $request->print(qq{
      Do you like fishies?<br>
      $link_yes $link_no
    });
    $request->next;
    $request->execute_callbacks;
    $request->print("All done here!");
  }



DESCRIPTION

This adds some methods to the $request object so you can easily do some callbacks.

METHODS

CW$html = CW$request->callback_link( ‘‘text’’ => sub { ... } );

Returns the HTML for an href callback.

CW$html = CW$request->callback_submit( ‘‘text’’ => sub { ... } );

Returns the HTML for a submit button callback.

CW$request->execute_callbacks

Execute callbacks, based on the params in $request. Call this after you’ve displayed the form and then done $request->next.

We don’t call this from within $request->next in case you need to do some processing before executing callbacks. Checking authentication is a good example of something you might be doing inbetween :)

By default the callbacks are cleared with ->clear_callbacks after all callbacks are processed. If you’d like, you can pass a hashref with a flag to indicate that the remaining callbacks shouldn’t be cleared, like this:



  $request->execute_callbacks( { no_clear_all => 1 } );



You might want to do this if, for example, you are doing some AJAX and don’t want one js component clearing the callbacks of another. It is most likely a bad idea though due to the ensuing memory leak. If it makes you feel any better, you can pass clear_executed in the same way to clear at least some, preventing double-execution. You’d probably use both flags:



  $request->execute_callbacks( { no_clear_all => 1, clear_executed => 1 } );



CW$request->clear_callbacks

Explicitly clear the current list of callbacks. This is already called at the end of execute_callbacks. It additionally exists here in case you want to clear the callbacks without processing.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CONTINUITY::REQUESTCALLBACKS (3) 2010-06-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.