Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::oauth::client(3pm) [debian man page]

Net::OAuth::Client(3pm) 				User Contributed Perl Documentation				   Net::OAuth::Client(3pm)

NAME
Net::OAuth::Client - OAuth 1.0A Client SYNOPSIS
# Web Server Example (Dancer) # This example is simplified for illustrative purposes, see the complete code in /demo # Note that client_id is the Consumer Key and client_secret is the Consumer Secret use Dancer; use Net::OAuth::Client; sub client { Net::OAuth::Client->new( config->{client_id}, config->{client_secret}, site => 'https://www.google.com/', request_token_path => '/accounts/OAuthGetRequestToken?scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F', authorize_path => '/accounts/OAuthAuthorizeToken', access_token_path => '/accounts/OAuthGetAccessToken', callback => uri_for("/auth/google/callback"), session => &session, ); } # Send user to authorize with service provider get '/auth/google' => sub { redirect client->authorize_url; }; # User has returned with token and verifier appended to the URL. get '/auth/google/callback' => sub { # Use the auth code to fetch the access token my $access_token = client->get_access_token(params->{oauth_token}, params->{oauth_verifier}); # Use the access token to fetch a protected resource my $response = $access_token->get('/m8/feeds/contacts/default/full'); # Do something with said resource... if ($response->is_success) { return "Yay, it worked: " . $response->decoded_content; } else { return "Error: " . $response->status_line; } }; dance; DESCRIPTION
Net::OAuth::Client represents an OAuth client or consumer. WARNING: Net::OAuth::Client is alpha code. The rest of Net::OAuth is quite stable but this particular module is new, and is under- documented and under-tested. METHODS
new($client_id, $client_secret, %params) Create a new Client o $client_id AKA Consumer Key - you get this from the service provider when you register your application. o $client_secret AKA Consumer Secret - you get this from the service provider when you register your application. o $params{site} o $params{request_token_path} o $params{authorize_path} o $params{access_token_path} o $params{callback} o $params{session} LICENSE AND COPYRIGHT
Copyright 2011 Keith Grennan. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. perl v5.14.2 2012-01-10 Net::OAuth::Client(3pm)

Check Out this Related Man Page

Server::Client(3pm)					User Contributed Perl Documentation				       Server::Client(3pm)

NAME
Net::SMTP::Server::Client - Client session handling for Net::SMTP::Server. SYNOPSIS
use Carp; use Net::SMTP::Server; use Net::SMTP::Server::Client; use Net::SMTP::Server::Relay; $server = new Net::SMTP::Server('localhost', 25) || croak("Unable to handle client connection: $! "); while($conn = $server->accept()) { # We can perform all sorts of checks here for spammers, ACLs, # and other useful stuff to check on a connection. # Handle the client's connection and spawn off a new parser. # This can/should be a fork() or a new thread, # but for simplicity... my $client = new Net::SMTP::Server::Client($conn) || croak("Unable to handle client connection: $! "); # Process the client. This command will block until # the connecting client completes the SMTP transaction. $client->process || next; # In this simple server, we're just relaying everything # to a server. If a real server were implemented, you # could save email to a file, or perform various other # actions on it here. my $relay = new Net::SMTP::Server::Relay($client->{FROM}, $client->{TO}, $client->{MSG}); } DESCRIPTION
The Net::SMTP::Server::Client module implements all the session handling required for a Net::SMTP::Server::Client connection. The above example demonstrates how to use Net::SMTP::Server::Client with Net::SMTP::Server to handle SMTP connections. $client = new Net::SMTP::Server::Client($conn) Net::SMTP::Server::Client accepts one argument that must be a handle to a connection that will be used for communication. Once you have a new client session, simply call: $client->process This processes an SMTP transaction. THIS MAY APPEAR TO HANG -- ESPECIALLY IF THERE IS A LARGE AMOUNT OF DATA BEING SENT. Once this method returns, the server will have processed an entire SMTP transaction, and is ready to continue. Once $client->process returns, various fields have been filled in. Those are: $client->{TO} -- This is an array containing the intended recipients for this message. There may be multiple recipients for any given message. $client->{FROM} -- This is the sender of the given message. $client->{MSG} -- The actual message data. :) AUTHOR AND COPYRIGHT Net::SMTP::Server / SMTP::Server is Copyright(C) 1999, MacGyver (aka Habeeb J. Dihu) <macgyver@tos.net>. ALL RIGHTS RESERVED. You may distribute this package under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. SEE ALSO
Net::SMTP::Server::Server, Net::SMTP::Server::Relay perl v5.10.1 1999-12-28 Server::Client(3pm)
Man Page