POE::Component::Metabase::Client::Submit - a POE client that submits to Metabase servers
version 0.14
use strict; use warnings; use POE qw[Component::Metabase::Client::Submit]; POE::Session->create( package_states => [ 'main' => [qw(_start _status)], ], ); sub _start { POE::Component::Metabase::Client::Submit->submit( event => '_status', uri => 'https://foo.bar.com/metabase/', fact => $metabase_fact_object, profile => $metabase_user_profile_object, secret => $metabase_user_secret_object, ); return; } sub _status { my $data = $_[ARG0]; print "Success!\n" if $data->{success}; print $data->{error}, "\n" if $data->{error}; return; }
POE::Component::Metabase::Client::Submit provides a POE mechanism for submitting facts to a Metabase web server.
submit
POE::Component::Metabase::Client::Submit->spawn( %args );
Constructs a POE session that will manage submitting a Metabase fact to a Metabase web server.
Takes a number of mandatory arguments:
'profile', a Metabase::User::Profile object 'secret', a Metabase::User::Secret object 'fact', a Metabase::Fact object 'event', an event handler in the calling session to invoke on completion 'uri', the uri of a Metabase server to submit to.
And some optional arguments:
'session', a session alias, reference or ID to send 'event' to instead of the calling session 'http_alias', the alias or ID of an existing POE::Component::Client::HTTP session to use. 'context', anything that can be stored in a scalar that is meaningful to you. 'resolver', a reference to a POE::Component::Resolver object to use (ignored if http_alias is used). 'compress', a compressor to use - defaults to none ( available compressors: gzip, deflate, x-bzip2, none )
An event will be sent to either the calling session or the session specified with session during submit.
session
ARG0 of the event will be a hashref with the following keys:
ARG0
success
Indicates that the submission was successful.
error
If there was an error this will contain a string indicating the error that occurred.
context
If you specified context in submit, whatever you passed will be here.
This will contain the content of any HTTP responses whether success or failure.
Metabase
POE
Chris Williams <chris@bingosnet.co.uk>
Ricardo SIGNES
David A. Golden
This software is copyright (c) 2017 by Chris Williams.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install POE::Component::Metabase::Client::Submit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Metabase::Client::Submit
CPAN shell
perl -MCPAN -e shell install POE::Component::Metabase::Client::Submit
For more information on module installation, please visit the detailed CPAN module installation guide.