view release on metacpan or search on metacpan
use EV::Etcd;
# Check if etcd is running
my $etcd_running = 0;
eval {
my $result = `etcdctl endpoint health 2>&1`;
$etcd_running = 1 if $result =~ /is healthy/;
};
die "etcd not running\n" unless $etcd_running;
my $client = EV::Etcd->new(
endpoints => ['127.0.0.1:2379'],
);
my $prefix = "/bench_$$";
my $iterations = $ENV{BENCH_ITER} || 1000;
view all matches for this distribution
view release on metacpan or search on metacpan
eg/etcd_series.pl view on Meta::CPAN
use feature 'say';
# Initialize Etcd client
# Note: Ensure etcd is running on localhost:2379
my $etcd = EV::Etcd->new(
endpoints => ['127.0.0.1:2379'],
);
my @steps = (
{ key => '/config/step1', val => 'init' },
{ key => '/config/step2', val => 'processing' },
view all matches for this distribution
view release on metacpan or search on metacpan
deps/hiredis/README.md view on Meta::CPAN
}
}
```
One can also use `redisConnectWithOptions` which takes a `redisOptions` argument
that can be configured with endpoint information as well as many different flags
to change how the `redisContext` will be configured.
```c
redisOptions opt = {0};
/* One can set the endpoint with one of our helper macros */
if (tcp) {
REDIS_OPTIONS_SET_TCP(&opt, "localhost", 6379);
} else {
REDIS_OPTIONS_SET_UNIX(&opt, "/tmp/redis.sock");
}
view all matches for this distribution
view release on metacpan or search on metacpan
eg/health_checker.pl view on Meta::CPAN
host => $ENV{NATS_HOST} // '127.0.0.1',
port => $ENV{NATS_PORT} // 4222,
on_error => sub { warn "nats: @_\n" },
on_connect => sub {
if ($mode eq 'service' || $mode eq 'both') {
# Register health endpoint
$nats->subscribe("health.$name", sub {
my ($subj, $payload, $reply) = @_;
return unless $reply;
# Simulate health: 90% healthy, 10% degraded
my $status = rand() < 0.9 ? 'healthy' : 'degraded';
$nats->publish($reply, "$name:$status:$$:" . int(rand(100)) . "ms");
});
print "service '$name' registered health endpoint\n";
if ($mode eq 'both') {
# Also register a second service for demo
$nats->subscribe("health.db", sub {
my ($subj, $payload, $reply) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
deps/hiredis/README.md view on Meta::CPAN
}
}
```
One can also use `redisConnectWithOptions` which takes a `redisOptions` argument
that can be configured with endpoint information as well as many different flags
to change how the `redisContext` will be configured.
```c
redisOptions opt = {0};
/* One can set the endpoint with one of our helper macros */
if (tcp) {
REDIS_OPTIONS_SET_TCP(&opt, "localhost", 6379);
} else {
REDIS_OPTIONS_SET_UNIX(&opt, "/tmp/redis.sock");
}
deps/hiredis/README.md view on Meta::CPAN
/* Finally various options may be set via the `options` member, as described below */
opt->options |= REDIS_OPT_PREFER_IPV4;
```
If a connection is lost, `int redisReconnect(redisContext *c)` can be used to restore the connection using the same endpoint and options as the given context.
### Configurable redisOptions flags
There are several flags you may set in the `redisOptions` struct to change default behavior. You can specify the flags via the `redisOptions->options` member.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Eixo/Docker/Container.pm view on Meta::CPAN
action=>'attach',
method=>'POST',
host=>$self->api->client->endpoint,
args=>\%args,
url_args=>[qw(logs stream stdin stdout stderr)],
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Eixo/Rest/Api.pm view on Meta::CPAN
sub DESTROY {}
sub initialize{
my ($self, $endpoint, %opts) = @_;
$self->client(
Eixo::Rest::Client->new($endpoint, %opts)
);
$self->SUPER::initialize(%opts);
$self;
view all matches for this distribution
view release on metacpan or search on metacpan
t/Elive/MockConnection.pm view on Meta::CPAN
my $self = {};
bless $self, $class;
$url ||= 'http://elive_mock_connection';
$url =~ s{/$}{}; # lose trailing '/'
$url =~ s{/webservice\.event$}{}; # lose endpoint
$url =~ s{/v[1-9]$}{}; # lose adapter path
if ($url =~ s{^(\w+)://(.*)\@}{$1://}) { # lose/capture credentials
my ($_user, $_pass) = split(':', $2, 2);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/ExactTarget.pm view on Meta::CPAN
sub soap_call
{
my ( $self, %args ) = @_;
my $verbose = $self->verbose();
my $use_test_environment = $self->use_test_environment();
my $endpoint = $use_test_environment
? $ENDPOINT_TEST
: $ENDPOINT_LIVE;
# Check the parameters.
confess 'You must define a SOAP action'
lib/Email/ExactTarget.pm view on Meta::CPAN
$args{'arguments'} ||= [];
# Do not forget to specify the soapaction (on_action), you will find it in the
# wsdl.
# - uri is the target namespace in the wsdl
# - proxy is the endpoint address
my $soap = SOAP::Lite
->uri( $NAMESPACE )
->on_action( sub { return '"' . $args{'action'} . '"' } )
->proxy( $endpoint )
->readable( ( $verbose ? 1 : 0 ) );
# You must define the namespace used in the wsdl, as an attribute to the
# method without namespace prefix for compatibility with .NET
# (document/literal).
lib/Email/ExactTarget.pm view on Meta::CPAN
SOAP::Header
->name( Action => $args{'action'} )
->uri( 'http://schemas.xmlsoap.org/ws/2004/08/addressing' )
->prefix( 'wsa' ),
SOAP::Header
->name( To => $endpoint )
->uri( 'http://schemas.xmlsoap.org/ws/2004/08/addressing' )
->prefix( 'wsa' ),
SOAP::Header
->name(
Security => \SOAP::Data->value(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/SendGrid/V3.pm view on Meta::CPAN
#pod =cut
sub send {
my ($self, %args) = @_;
my $api_key = $args{api_key} || $self->{api_key} or croak "API key is required to send";
my $endpoint = $args{endpoint} || $self->{endpoint} || DEFAULT_ENDPOINT;
my $payload = $self->_payload;
my $http = HTTP::Tiny->new(
keep_alive => 0,
default_headers => {
lib/Email/SendGrid/V3.pm view on Meta::CPAN
'Authorization' => "Bearer $api_key",
},
);
my $response = $http->post(
$endpoint, { content => $payload },
);
return $response;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Sender/Transport/Mailgun.pm view on Meta::CPAN
# Percent-escape anything other than alphanumeric and - _ . ~
# https://github.com/sdt/Email-Sender-Transport-Mailgun/issues/4
my $api_key = $self->api_key;
$api_key =~ s/[^-_.~0-9a-zA-Z]/sprintf('%%%02x',ord($&))/eg;
# adapt endpoint based on region setting.
$rest =~ s/(\.mailgun)/sprintf('.%s%s', $self->region, $1)/e
if defined $self->region && $self->region ne 'us';
return "$proto://api:$api_key\@$rest/$domain";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Endoscope.pm view on Meta::CPAN
queries and view their output can read the contents of nearly any variable
present in memory. As such, access to these capabilities should be carefully
guarded.
For example, if C<Endoscope> is integrated into a web framework and exposes
a special HTTP endpoint for configuring queries, that endpoint should only be
accessible from the host where the application is running, not externally.
Additionally, that HTTP endpoint should be gated by strong
authentication/authorization.
=head1 SEE ALSO
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
contrib/benchmark.pl view on Meta::CPAN
<p>You see, <a href="https://metacpan.org">MetaCPAN</a> does not only have a pretty face,
but also has a <a href="https://github.com/CPAN-API/cpan-api/wiki/Beta-API-docs">smashing backend</a>
that can be used <a href="http://explorer.metacpan.org/">straight-up</a> for fun and
profit.</p>
<p>Accessing REST endpoints is not hard, but it's a little bit of a low-level
chore. In Perl space, there is already <a href='http://search.cpan.org/dist/MetaCPAN-API'>MetaCPAN::API</a> to
abstract</p>
<pre class="brush: perl">my $ua = LWP::UserAgent;
my $me = decode_json(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Etcd.pm view on Meta::CPAN
Queries and returns the server version as a string.
=head1 ENDPOINTS
Individual API endpoints are implemented in separate modules. See the documentation for the following modules for more information:
=over 4
=item *
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Etcd3/Auth.pm view on Meta::CPAN
# grant role
$etcd->user_role( { user => 'samba', role => 'myrole' })->grant;
=cut
=head2 endpoint
=cut
has endpoint => (
is => 'ro',
isa => Str,
);
=head2 password
lib/Etcd3/Auth.pm view on Meta::CPAN
=cut
sub authenticate {
my ( $self, $options ) = @_;
$self->{endpoint} = '/auth/authenticate';
confess 'name and password required for ' . __PACKAGE__ . '->authenticate'
unless ($self->{password} && $self->{name});
$self->request;
return $self;
}
lib/Etcd3/Auth.pm view on Meta::CPAN
=cut
sub enable {
my ( $self, $options ) = @_;
$self->{endpoint} = '/auth/enable';
$self->{json_args} = '{}';
$self->request;
return $self;
}
lib/Etcd3/Auth.pm view on Meta::CPAN
=cut
sub disable {
my ( $self, $options ) = @_;
$self->{endpoint} = '/auth/disable';
confess 'root name and password required for ' . __PACKAGE__ . '->disable'
unless ($self->{password} && $self->{name});
$self->request;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EveOnline/SSO/Client.pm view on Meta::CPAN
has 'token' => (
is => 'rw',
required => 1,
);
has 'endpoint' => (
is => 'rw',
required => 1,
default => 'https://esi.tech.ccp.is/latest/',
);
lib/EveOnline/SSO/Client.pm view on Meta::CPAN
Require arguments: token, x_user_agent
my $client = EveOnline::SSO::Client->new(
token => 'lPhJ_DLk345334532yfssfdJgFsnKI9rR4EZpcQnJ2',
x_user_agent => 'Pilot Name <email@gmail.com>',
endpoint => 'https://esi.tech.ccp.is/latest/', # optional
datasource => 'tranquility', # optional
);
For module based on EveOnline::SSO::Client
you can override atributes:
extends 'EveOnline::SSO::Client';
has '+endpoint' => (
is => 'rw',
default => 'https://esi.tech.ccp.is/dev/',
);
has '+datasource' => (
is => 'rw',
lib/EveOnline/SSO/Client.pm view on Meta::CPAN
return $resource if $resource =~ /^http/i;
my $url = '';
$url = $self->endpoint;
$url .= join '/', @$resource;
$url .= '/';
my $uri = URI->new( $url );
$uri->query_form( %{$params || {}}, datasource => $self->datasource );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Excel/Writer/XLSX/Shape.pm view on Meta::CPAN
=head2 adjustments
Adjustment of shape vertices. Most shapes do not use this. For some shapes, there is a single adjustment to modify the geometry. For instance, the plus shape has one adjustment to control the width of the spokes.
Connectors can have a number of adjustments to control the shape routing. Typically, a connector will have 3 to 5 handles for routing the shape. The adjustment is in percent of the distance from the starting shape to the ending shape, alternating bet...
=head2 stencil
Shapes work in stencil mode by default. That is, once a shape is inserted, its connection is separated from its master. The master shape may be modified after an instance is inserted, and only subsequent insertions will show the modifications.
view all matches for this distribution
view release on metacpan or search on metacpan
azure-pipelines.yml view on Meta::CPAN
resources:
repositories:
- repository: ci-perl-helpers
type: github
name: houseabsolute/ci-perl-helpers
endpoint: houseabsolute
stages:
- template: templates/helpers/build.yml@ci-perl-helpers
parameters:
debug: true
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Exobrain/Agent/Foursquare.pm view on Meta::CPAN
my $checkins = $self->foursquare_api('checkins/recent',
afterTimestamp => $last_check,
);
Calls the Foursquare API endpoint specified in the first argument, and converts
the response into a Perl data structure. All additional named arguments are
considered to be parameters that will be appended to the call.
This method automatically adds auth tokens and version strings as appropriate.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Exobrain/Bus.pm view on Meta::CPAN
# ABSTRACT: Connection to the Exobrain bus
our $VERSION = '1.08'; # VERSION
my $context = ZMQ::Context->new; # Context is always shared.
my $endpoint = 'tcp://localhost:3568/'; # TODO: From config file?
my $router = Exobrain::Router->new;
has context => ( is => 'ro', default => sub { $context } );
has router => ( is => 'ro', default => sub { $router } );
has type => ( is => 'ro', ); # TODO: Type
view all matches for this distribution
view release on metacpan or search on metacpan
Change: 274137bfe1e2b49a199b4f6a2be69019aa323535
Author: Tudor Constantin <tudorconstantin@gmail.com>
Date : 2012-07-09 00:28:23 +0000
basic infrastructure created for API endpoints
Change: e6eb43b478630acea753e8d72dc93c6c2a933181
Author: Tudor Constantin <tudorconstantin@gmail.com>
Date : 2012-07-08 21:49:07 +0000
view all matches for this distribution
view release on metacpan or search on metacpan
lib/FAST/Bio/Location/Atomic.pm view on Meta::CPAN
=head2 min_end
Title : min_end
Usage : my $minend = $location->min_end();
Function: Get minimum ending location of feature endpoint
Returns : integer or undef if no minimum ending point.
Args : none
=cut
lib/FAST/Bio/Location/Atomic.pm view on Meta::CPAN
=head2 max_end
Title : max_end
Usage : my $maxend = $location->max_end();
Function: Get maximum ending location of feature endpoint
In this implementation this is exactly the same as min_end().
Returns : integer or undef if no maximum ending point.
Args : none
view all matches for this distribution
view release on metacpan or search on metacpan
examples/zmq3.pl view on Meta::CPAN
use FFI::CheckLib qw( find_lib_or_die );
use FFI::Platypus 2.00;
use FFI::Platypus::Memory qw( malloc );
use FFI::Platypus::Buffer qw( scalar_to_buffer window );
my $endpoint = "ipc://zmq-ffi-$$";
my $ffi = FFI::Platypus->new(
api => 2,
lib => find_lib_or_die lib => 'zmq',
);
examples/zmq3.pl view on Meta::CPAN
my $context = zmq_ctx_new();
zmq_ctx_set($context, ZMQ_IO_THREADS, 1);
my $socket1 = zmq_socket($context, ZMQ_REQ);
zmq_connect($socket1, $endpoint);
my $socket2 = zmq_socket($context, ZMQ_REP);
zmq_bind($socket2, $endpoint);
{ # send
our $sent_message = "hello there";
my($pointer, $size) = scalar_to_buffer $sent_message;
my $r = zmq_send($socket1, $pointer, $size, 0);
view all matches for this distribution
view release on metacpan or search on metacpan
deps/hidapi/hidapi/hidapi.h view on Meta::CPAN
if a hid report is 16 bytes long, 17 bytes must be passed to
hid_write(), the Report ID (or 0x0, for devices with a
single report), followed by the report data (16 bytes). In
this example, the length passed in would be 17.
hid_write() will send the data on the first OUT endpoint, if
one exists. If it does not, it will send the data through
the Control Endpoint (Endpoint 0).
This function sets the return value of hid_error().
deps/hidapi/hidapi/hidapi.h view on Meta::CPAN
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length);
/** @brief Read an Input report from a HID device with timeout.
Input reports are returned
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
This function sets the return value of hid_error().
@ingroup API
deps/hidapi/hidapi/hidapi.h view on Meta::CPAN
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
/** @brief Read an Input report from a HID device.
Input reports are returned
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
This function sets the return value of hid_error().
@ingroup API
deps/hidapi/hidapi/hidapi.h view on Meta::CPAN
*/
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock);
/** @brief Send a Feature report to the device.
Feature reports are sent over the Control endpoint as a
Set_Report transfer. The first byte of @p data[] must
contain the Report ID. For devices which only support a
single report, this must be set to 0x0. The remaining bytes
contain the report data. Since the Report ID is mandatory,
calls to hid_send_feature_report() will always contain one
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Facebook/OpenGraph.pm view on Meta::CPAN
client_secret => $self->secret,
};
my $response = $self->request('GET', '/oauth/access_token', $param_ref);
# Document describes as follows:
# "The response you will receive from this endpoint, if successful, is
# access_token={access-token}&expires={seconds-til-expiration}
# If it is not successful, you'll receive an explanatory error message."
#
# It, however, returnes no "expires" parameter on some edge cases.
# e.g. Your app requests manage_pages permission.
lib/Facebook/OpenGraph.pm view on Meta::CPAN
This module is inspired by L<Facebook::Graph>, but mainly focuses on simplicity
and customizability because we must be able to keep up with frequently changing
API specification.
This module does B<NOT> provide ways to set and validate parameters for each
API endpoint like Facebook::Graph does with Any::Moose. Instead it provides
some basic methods for HTTP request. It also provides some handy methods that
wrap C<request()> for you to easily utilize most of Graph API's functionalities
including:
=over 4
lib/Facebook/OpenGraph.pm view on Meta::CPAN
=item * Posting Staging Resource for Open Graph Object
=back
In most cases you can specify endpoints and request parameters by yourself and
pass them to request() so it should be easier to test latest API specs. Other
requesting methods merely wrap request() method for convinience.
=head1 METHODS
lib/Facebook/OpenGraph.pm view on Meta::CPAN
It parses signed_request that Facebook Platform gives to you on various
situations. situations may include
=over 4
=item * Given as a URL fragment on callback endpoint after login flow is done
with Login Dialog
=item * POSTed when Page Tab App is loaded
=item * Set in a form of cookie by JS SDK
lib/Facebook/OpenGraph.pm view on Meta::CPAN
DB and override this method to return the stored value.
=head3 C<< $fb->get_user_token_by_code($given_code) >>
Obtain an access token for user based on C<$code>. C<$code> should be obtained
on your callback endpoint which is specified on C<eredirect_uri>. Give the
returning access token to C<set_access_token()> and you can act on behalf of
the user.
FYI: I<expires> or I<expires_in> is B<NOT> returned on some edge cases. The
detail and reproductive scenario should be found at
lib/Facebook/OpenGraph.pm view on Meta::CPAN
]);
# 'name,email,albums.fields(name,photos.fields(name,picture,tags.limit(2)).limit(3)).limit(5)'
=head3 C<< $fb->publish_action($action_type, \%param) >>
Alias to C<request()> that optimizes body content and endpoint to send C<POST>
request to publish Open Graph Action.
my $res = $fb->publish_action('give', +{crap => 'https://sample.com/poop/'});
#{id => 123456}
view all matches for this distribution
view release on metacpan or search on metacpan
FDkeeper/Client.pm view on Meta::CPAN
while (my ($k, $v) = each %args){
croak("Invalid attribute '$k'") ;
}
my $client = endp_connect($path) ;
croak("Error connecting to server endpoint '$path': $!") unless $client ;
$client->autoflush(1) ;
$this->{client} = $client ;
return $this ;
}
view all matches for this distribution
view release on metacpan or search on metacpan
FDpasser.pm view on Meta::CPAN
=head1 DESCRIPTION
File::FDpasser is a module for passing open filedescriptors
to and from other scripts or even other programs.
An endpoint is just a Filehandle that can be used to
send and receive filehandles over. To create two endpoints
before forking spipe() is used - it returns two endpoints
or undef on failiure.
If the processes are unrelated or can not use spipe() for
some reason, it is possible to create a 'server endpoint'
in the filesystem by calling endp_create(). That endpoint
can be polled for incomming connections similar to how sockets
are polled for incomming connection. To accept an incomming
connection serv_accept_fh() is used. It returns a filehandle
or undef on failiure.
To connect to a server endpoint from a client program
endp_connect() is used. It returns a filehandle to an
open connection.
Irregardless of how the endpoints were created send_file()
is used to send an open filehandle to the process who has
other end of the pipe or socket. The first argument to
send_file is the connection to send the open handle over.
The second argument is the actual handle to send.
Similarly recv_fh() is always used to receive an open
FDpasser.pm view on Meta::CPAN
Under BSD derived systems open filedescriptors are passed over
unix domain sockets. SysV systems however pass them over streams.
This means to create that under BSD socketpair() is used to
create the socket endpoints. While SysV uses pipe() since
pipe on SysV creates a bidirectional stream based pipe.
This is all nice and dandy if you are going to fork later on
since both child and parent are going to have an endpoint to
read from or write to.
endp_create() is used to create a server endpoint that can
be polled for incomming connections with poll or select.
Under BSD the perl call socket() is used to create a Unix Domain
Socket in the filesystem. Under SysV the perl function pipe()
is called followed by an XS function that pushes the conn_ld module
on one end of the stream pipe and then calles fattach to attach
the pipe end to a point in the filesystem.
To connect to a server endpoint in BSD a socket is created (but not
bound to any point in the filesystem) and a connect call is made.
In SysV a normal open() in perl is made.
The actuall sending of filedescriptors is done with XS functions
that under BSD use sendmsg for sending and recvmsg for reciving.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Fu/Dir.pm view on Meta::CPAN
if(@want == 2) {
foreach my $end (@want) {
$end = $#{$self->{dirs}} + 1 + $end if($end < 0);
}
if($want[0] > $want[1]) {
croak("first endpoint '$want[0]' is after last '$want[1]'");
}
@want = $want[0]..$want[1];
}
# TODO else check contiguity?
return(@{$self->{dirs}}[@want]);
view all matches for this distribution
view release on metacpan or search on metacpan
azure-pipelines.yml view on Meta::CPAN
resources:
repositories:
- repository: ci-perl-helpers
type: github
name: houseabsolute/ci-perl-helpers
endpoint: houseabsolute
stages:
- template: templates/helpers/build.yml@ci-perl-helpers
parameters:
debug: true
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/VirusScan/Engine/Daemon/FPROT/V4.pm view on Meta::CPAN
while (my $output = $sock->getline) {
if($output =~ /^\s*$/) {
last; # End of headers
#### Below here: Validating the protocol
#### If the protocol is not recognized, it's assumed that the
#### endpoint is not an F-Prot demon, hence,
#### the next port is probed.
} elsif($output =~ /^HTTP(.*)/) {
my $h = $1;
next SEARCH_DEMON unless $h =~ m!/1\.0\s+200\s!;
} elsif($output =~ /^Server:\s*(\S*)/) {
view all matches for this distribution