NAME POE::Component::Metabase::Client::Submit - a POE client that submits to Metabase servers SYNOPSIS 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; } DESCRIPTION POE::Component::Metabase::Client::Submit provides a POE mechanism for submitting facts to a Metabase web server. CONSTRUCTOR "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). OUTPUT EVENT An event will be sent to either the calling session or the session specified with "session" during "submit". "ARG0" of the event will be a hashref with the following keys: "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. AUTHORS David A. Golden (DAGOLDEN) Ricardo SIGNES (RJBS) Chris Williams (BINGOS) COPYRIGHT AND LICENSE Portions Copyright (c) 2008 by Ricardo SIGNES Portions Copyright (c) 2009-2010 by David A. Golden Portions Copyright (c) 2010 by Chris Williams Licensed under the same terms as Perl itself (the "License"). You may not use this file except in compliance with the License. A copy of the License was distributed with this file or you may obtain a copy of the License from http://dev.perl.org/licenses/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SEE ALSO Metabase POE