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
RPC::ExtDirect::Event(3) User Contributed Perl Documentation RPC::ExtDirect::Event(3)

RPC::ExtDirect::Event - Asynchronous server-to-client events

  use RPC::ExtDirect;
  use RPC::ExtDirect::Event;
 
  sub foo : ExtDirect(pollHandler) {
     my ($class) = @_;
 
     # Do something good, collect results in $good_data
     my $good_data = { ... };
 
     # Do something bad, collect results in $bad_data
     my $bad_data = [ ... ];
 
     # Return the data as a list (not arrayref!)
     return (
                 RPC::ExtDirect::Event->new('good', $good_data),
                 RPC::ExtDirect::Event->new(
                    name => 'bad',
                    data => $bad_data,
                ),
            );
 }

This module implements Event object that is used to send asynchronous events from server to client via periodic polling.

Data can be anything that is serializable to JSON. No checks are made and it is assumed that client side can understand the data format used with Events.

Note that by default JSON will blow up if you try to feed it a blessed object as data payload, and for very good reason: it is not obvious how to serialize a self-contained object. To avoid this, set a global Config option json_options to include "allow_blessed" flag:

    my $config = RPC::ExtDirect->get_api->config;
    $config->json_options({
        allow_blessed => 1,
    });

"new"
Constructor. Creates a new Event object with event name and some data. Accepts arguments by position as "new($name, $data)", as well as by name in a hash or hashref:

    my $event1 = RPC::ExtDirect::Event->new( 'foo', 'bar' );
    my $event2 = RPC::ExtDirect::Event->new({
        name => 'foo',
        data => 'bar',
    });
    my $event3 = RPC::ExtDirect::Event->new(
        name => 'foo',
        data => 'bar'
    );
    

This makes it easier to extend Event objects in a Moose(ish) environment, etc.

"run"
Instance method. Not intended to be called directly, provided for duck typing compatibility with Exception and Request objects.
"result"
Instance method. Returns an Event hashref in format required by Ext.Direct client stack. Not intended to be called directly.
2015-01-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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