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  -  RPC::EXTDIRECT::EVENT (3)

.ds Aq ’

NAME

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

CONTENTS

SYNOPSIS



  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,
                ),
            );
 }



DESCRIPTION

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,
    });



METHODS

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.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 RPC::EXTDIRECT::EVENT (3) 2015-01-30

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