view release on metacpan or search on metacpan
lib/Geo/Coder/GeoApify.pm view on Meta::CPAN
If not provided,
an in-memory cache is created with a default expiration of one hour.
=item * C<host>
The API host endpoint.
Defaults to L<https://api.geoapify.com/v1/geocode>.
=item * C<min_interval>
Minimum number of seconds to wait between API requests.
view all matches for this distribution
view release on metacpan or search on metacpan
gentest/gentest_ellipsoid.pl view on Meta::CPAN
my( $r1,$r2,$r3,$r4,$r5);
EOS
$tests{range}{code} = [ $code ];
${$tests{range}}{count} = 0;
# test endpoints: poles and equator
for( my $lat1 = $lat0; $lat1 <= 90; $lat1 += $latinc ) {
for( my $lon1 = $lon0; $lon1 <= 270; $lon1 += $loninc ) {
next if abs($lat1) == 90 and $lon1 > 0;
print " loc1 = ($lat1,$lon1)\n" if $debug;
for( my $lat2 = $lat0; $lat2 <= 90; $lat2 += $latinc ) {
view all matches for this distribution
view release on metacpan or search on metacpan
src/mapbox/earcut.hpp view on Meta::CPAN
double hy = hole->y;
double qx = -std::numeric_limits<double>::infinity();
Node* m = nullptr;
// find a segment intersected by a ray from the hole's leftmost Vertex to the left;
// segment's endpoint with lesser x will be potential connection Vertex
do {
if (hy <= p->y && hy >= p->next->y && p->next->y != p->y) {
double x = p->x + (hy - p->y) * (p->next->x - p->x) / (p->next->y - p->y);
if (x <= hx && x > qx) {
qx = x;
src/mapbox/earcut.hpp view on Meta::CPAN
if (!m) return 0;
if (hx == qx) return m->prev;
// look for points inside the triangle of hole Vertex, segment intersection and endpoint;
// if there are no points found, we have a valid connection;
// otherwise choose the Vertex of the minimum angle with the ray as connection Vertex
const Node* stop = m;
double tanMin = std::numeric_limits<double>::infinity();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Geo/Google/PolylineEncoder.pm view on Meta::CPAN
package Geo::Google::PolylineEncoder;
use strict;
use warnings;
use accessors qw(num_levels zoom_factor visible_threshold force_endpoints
zoom_level_breaks escape_encoded_points lons_first
points dists max_dist encoded_points encoded_levels );
use constant defaults => {
num_levels => 18,
zoom_factor => 2,
force_endpoints => 1,
escape_encoded_points => 0,
visible_threshold => 0.00001,
lons_first => 0,
};
our $VERSION = 0.06;
lib/Geo/Google/PolylineEncoder.pm view on Meta::CPAN
my $visible_threshold = $self->visible_threshold;
my $zoom_level_breaks = $self->zoom_level_breaks;
my $encoded_levels = "";
if ($self->force_endpoints) {
$encoded_levels .= $self->encode_number($num_levels_minus_1);
} else {
$encoded_levels .= $self->encode_number($num_levels_minus_1 - $self->compute_level($max_dist));
}
lib/Geo/Google/PolylineEncoder.pm view on Meta::CPAN
$encoded_levels .= $self->encode_number($num_levels_minus_1 - $level);
}
}
if ($self->force_endpoints) {
$encoded_levels .= $self->encode_number($num_levels_minus_1);
} else {
$encoded_levels .= $self->encode_number($num_levels_minus_1 - $self->compute_level($max_dist));
}
lib/Geo/Google/PolylineEncoder.pm view on Meta::CPAN
=item new( [%args] )
Create a new encoder. Arguments are optional and correspond to the accessor
with the same name: L</num_levels>, L</zoom_factor>, L</visible_threshold>,
L</force_endpoints>, etc...
Note: there's nothing stopping you from setting these properties each time you
L</encode> a polyline.
=item num_levels
lib/Geo/Google/PolylineEncoder.pm view on Meta::CPAN
=item visible_threshold
Indicates the length of a barely visible object at the highest zoom level.
Default: 0.00001. err.. units.
=item force_endpoints
Indicates whether or not the endpoints should be visible at all zoom levels.
force_endpoints is. Probably should stay true regardless.
Default: 1=true.
=item escape_encoded_points
Indicates whether or not the encoded points should have escape characters
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Geo/TCX.pm view on Meta::CPAN
if ( $o->{tag_course} ) {
# in Courses, data is structured as <Lap>...</Lap><Lap>...</Lap><Track>...</Track><Track>...</Track>
# actually, not sure just seem like it's one long ... track, not multiple ones, which complicates things
my $xml_str = $o->{tag_course};
my (@lap_tags, @lap_endpoints, @track_tags);
if ( $xml_str =~ m,(<Lap>.*</Lap>),s ) {
my $str = $1;
@lap_tags = split(/(?s)<\/Lap>\s*<Lap>/, $str );
if (@lap_tags == 0) { push @lap_tags, $str }
lib/Geo/TCX.pm view on Meta::CPAN
for my $i (0 .. $#lap_tags) {
my ($end_pos, $end_pt);
if ( $lap_tags[$i] =~ m,<EndPosition>(.*)</EndPosition>,s ) {
$end_pt = Geo::TCX::Trackpoint->new( $1 );
push @lap_endpoints, $end_pt
}
# since split removed tags sometimes at ^ of string for other at $
# let's remove them all and add back
$lap_tags[$i] =~ s,</?Lap>,,g;
$lap_tags[$i] =~ s,^,<Lap>,g;
lib/Geo/TCX.pm view on Meta::CPAN
if (@lap_tags ==1) { $track_tags[0] = $track_str }
else {
my ($t1, $t2);
for my $i (0 .. $#lap_tags ) {
if ($i < $#lap_tags) {
($t1, $t2) = $t->split_at_point_closest_to( $lap_endpoints[$i] );
push @track_tags, $t1->xml_string;
$t = $t2
} else { push @track_tags, $t->xml_string } # ie don't split the last track portion
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Geo/What3Words.pm view on Meta::CPAN
sub new {
my ($class, %params) = @_;
my $self = {};
$self->{api_endpoint} = $params{api_endpoint} || 'https://api.what3words.com/v3/';
$self->{key} = $params{key} || die "API key not set";
$self->{language} = $params{language};
$self->{logging} = $params{logging};
## _ua is used for testing. But could also be used to
lib/Geo/What3Words.pm view on Meta::CPAN
sub ping {
my $self = shift;
## http://example.com/some/path => example.com
## also works with IP addresses
my $host = URI->new($self->{api_endpoint})->host;
$self->_log("pinging $host...");
my $netping = Net::Ping->new('external');
my $res = $netping->ping($host);
lib/Geo/What3Words.pm view on Meta::CPAN
foreach my $key (keys %$rh_fields) {
delete $rh_fields->{$key} if (!defined($rh_fields->{$key}));
}
my $uri = URI->new($self->{api_endpoint} . $method_name);
$uri->query_form($rh_fields);
my $url = $uri->as_string;
$self->_log("GET $url");
my $response = $self->{ua}->get($url);
lib/Geo/What3Words.pm view on Meta::CPAN
=item language
Default language for 3 word addresses (e.g. C<'ru'>, C<'de'>). Can be
overridden per request.
=item api_endpoint
Override the API URL. Defaults to C<https://api.what3words.com/v3/>.
=item ua
view all matches for this distribution
view release on metacpan or search on metacpan
lib/GeoIP2/Record/Traits.pm view on Meta::CPAN
This returns the autonomous system number
(L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) associated with
the IP address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->autonomous_system_organization()
This returns the organization associated with the registered autonomous system
number (L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) for the IP
address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->connection_type()
This returns the connection type associated with the IP address. It may take
the following values: C<Dialup>, C<Cable/DSL>, C<Corporate>, or C<Cellular>.
lib/GeoIP2/Record/Traits.pm view on Meta::CPAN
This returns the second level domain associated with the IP address. This will
be something like "example.com" or "example.co.uk", not "foo.example.com".
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->ip_address()
This returns the IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the externally
lib/GeoIP2/Record/Traits.pm view on Meta::CPAN
=head2 $traits_rec->isp()
This returns the name of the ISP associated with the IP address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->organization()
This returns the name of the organization associated with the IP address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->user_type()
This returns the user type associated with the IP address. This can be one of
the following values:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gerrit/REST.pm view on Meta::CPAN
=back
=head1 METHODS
Gerrit's REST API documentation lists dozens of "endpoints" which can
be operated via the standard HTTP requests: GET, DELETE, PUT, and
POST. Gerrit::REST objects implement four methods called GET, DELETE,
PUT, and POST to make it easier to invoke and get results from
Gerrit's REST endpoints.
All four methods need a RESOURCE argument which is simply a string
denoting the endpoint URL's path, as indicated in the documentation.
PUT and POST second argument (usually a hash-ref, but sometimes a simple
string) is encoded using the C<encode> method of a C<JSON> object and passed
as contents of the underlying associated HTTP method.
All four methods return the value returned by the associated
endpoint's method, as specified in the documentation, decoded
according to its content type as follows:
=over
=item * application/json
The majority of the API's endpoints return JSON values. Those are
decoded using the C<decode> method of a C<JSON> object. Most of the
endpoints return hashes, which are returned as a Perl hash-ref.
=item * text/plain
Those values are returned as simple strings.
=back
Some endpoints don't return anything. In those cases, the methods
return C<undef>. The methods croak if they get any other type of
values in return.
In case of errors (i.e., if the underlying HTTP method return an error code
different from 2xx) the methods croak with a string error message.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/07-config.pl view on Meta::CPAN
# then from the spec default. Without --config, every existing file in
# 'paths' is loaded in order, and a later file overrides an earlier one
# option by option. --config FILE loads only that file; a bare --config
# loads 'defaultPath'. --create-default-config writes a starter file with
# the defaults. Config files are grouped like the help output: 'retries'
# and 'endpoint' are set under "Network".
#
# 07-config.json next to this script is the first file in 'paths'. The
# second one, ~/.example07.json, does not exist until you create it.
#
# Try:
# perl examples/07-config.pl (endpoint and retries from 07-config.json)
# perl examples/07-config.pl --retries 1 (the command line wins over the file)
# perl examples/07-config.pl --create-default-config ~/.example07.json
# (edit retries in ~/.example07.json, e.g. to 9, then:)
# perl examples/07-config.pl (retries from ~/.example07.json, endpoint still from 07-config.json)
# perl examples/07-config.pl --config (only the defaultPath, ~/.example07.json)
# perl examples/07-config.pl --config examples/07-config.json
# perl examples/07-config.pl --help
use v5.26;
examples/07-config.pl view on Meta::CPAN
default => 3,
min => 0,
group => 'Network',
help => 'How often to retry a failed request',
},
'endpoint' => {
type => 'url',
group => 'Network',
help => 'The server to talk to',
},
},
view all matches for this distribution
view release on metacpan or search on metacpan
examples/burst view on Meta::CPAN
my $m = sin($angle)/cos($angle);
if ($m ==0) { $m = 0.000000000001; } #avoid div by 0
if ($c ==0) { $c = 0.000000000001; } #avoid div by 0
if ($d ==0) { $d = 0.000000000001; } #avoid div by 0
# find the positive solution of the quadratic for the endpoints
my $x = sqrt(1/((1/$a/$a)+($m*$m/$b/$b)));
my $y = sqrt(1/((1/($m*$m*$a*$a))+(1/$b/$b)));
# and find the starting points in the same manner
my $x_start = sqrt(1/((1/$c/$c)+($m*$m/$d/$d)));
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-check-jira.t view on Meta::CPAN
fixVersions => [{name => 'master'}],
}},
);
sub GET {
my ($jira, $endpoint) = @_;
my $key;
if ($endpoint =~ m:/issue/(.*):) {
$key = $1;
} else {
die "JIRA::Client(fake): no such endpoint ($endpoint)\n";
}
if (exists $issues{$key}) {
return $issues{$key};
} else {
die "JIRA::Client(fake): no such issue ($key)\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Git/Raw/Walker.pm view on Meta::CPAN
Push HEAD of the repository to the list of commits to be used as roots when
starting a revision walk.
=head2 push_range( $start, $end )
Push and hide the respective endpoints of the given range. C<$start> and C<$end>
should be C<"commitish">, that is, it should be a L<Git::Raw::Commit> or
L<Git::Raw::Reference> object, or alternatively a commit id or commit id prefix.
=head2 push_range( $range )
Push and hide the respective endpoints of the given range. C<$range> should be
of the form C<"start_commit_id..end_commit_id">.
=head2 hide( $commit )
Hide a L<Git::Raw::Commit> and its ancestors from the walker.
view all matches for this distribution
view release on metacpan or search on metacpan
author/generate.pl view on Meta::CPAN
foreach my $section_pack (@{ $config->{sections} }) {
foreach my $section_name (keys %$section_pack) {
my $section = $section_pack->{$section_name};
my $file = $dir->child("$section_name.yml");
my $endpoints = YAML::XS::Load( $file->slurp() );
print "=head1 $section->{head}\n\n";
print "See L<$section->{doc_url}>.\n\n";
foreach my $endpoint_pack (@$endpoints) {
foreach my $sub (keys %$endpoint_pack) {
my $spec = $endpoint_pack->{$sub};
my ($return, $method, $path, $params_ok);
if ($spec =~ m{^(?:(\S+) = |)(GET|POST|PUT|DELETE) (\S+?)(\??)$}) {
($return, $method, $path, $params_ok) = ($1, $2, $3, $4);
}
view all matches for this distribution
view release on metacpan or search on metacpan
author/generate.pl view on Meta::CPAN
foreach my $section_pack (@{ $config->{sections} }) {
foreach my $section_name (keys %$section_pack) {
my $section = $section_pack->{$section_name};
my $file = $dir->child("$section_name.yml");
my $endpoints = YAML::XS::Load( $file->slurp() );
print "=head2 $section->{head}\n\n";
print "See L<$section->{doc_url}>.\n\n";
print "=over\n\n";
foreach my $endpoint (@$endpoints) {
if (keys(%$endpoint) == 1) {
my ($method) = keys %$endpoint;
$endpoint = {
method => $method,
spec => $endpoint->{$method},
};
}
my $method = $endpoint->{method};
my $spec = $endpoint->{spec};
my ($return, $verb, $path, $params_ok);
if ($spec =~ m{^(?:(\S+) = |)(GET|POST|PUT|DELETE) ([^/\s]\S*?[^/\s]?)(\??)$}) {
($return, $verb, $path, $params_ok) = ($1, $2, $3, $4);
}
author/generate.pl view on Meta::CPAN
die "Invalid spec ($method): $spec";
}
my $no_decode = 0;
$no_decode = 1 if !$return;
$no_decode = 1 if $endpoint->{no_decode};
print "=item $method\n\n";
print ' ';
print "my \$$return = " if $return;
author/generate.pl view on Meta::CPAN
print ");\n\n";
print "Sends a C<$verb> request to C<$path>";
print ' and returns the ' . ($no_decode ? 'raw' : 'decoded') . ' response content' if $return;
print ".\n\n";
print "$endpoint->{note}\n" if $endpoint->{note};
print "=cut\n\n";
print "sub $method {\n";
print " my \$self = shift;\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Ads/AdWords/Client.pm view on Meta::CPAN
if ($@) {
warn("Module $module_name was not found.");
return;
} else {
# Generating the service endpoint url of the form
# https://{server_url}/{group_name(cm/job/info/o)}/{version}/{service}.
my $server_url =
$self->get_alternate_url() =~ /\/$/
? substr($self->get_alternate_url(), 0, -1)
: $self->get_alternate_url();
my $service_to_group_name =
$Google::Ads::AdWords::Constants::SERVICE_TO_GROUP{$method_name};
if (!$service_to_group_name) {
die("Service " . $method_name . " is not configured in the library.");
}
my $endpoint_url =
sprintf(Google::Ads::AdWords::Constants::PROXY_FORMAT_STRING,
$server_url, $service_to_group_name, $self->get_version(),
$method_name);
# If a suitable module is found, instantiate it and store it in
# instance-specific storage to emulate a singleton.
my $service_port = $module_name->new({
# Setting the server endpoint of the service.
proxy => [$endpoint_url],
# Associating our custom serializer.
serializer =>
Google::Ads::AdWords::Serializer->new({client => $self}),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Ads/GoogleAds/Constants.pm view on Meta::CPAN
use constant DEFAULT_API_VERSION => "V25";
# The Google OAuth2 service base URL.
use constant OAUTH2_BASE_URL => "https://accounts.google.com/o/oauth2";
# The Google OAuth2 tokeninfo endpoint.
use constant OAUTH2_TOKEN_INFO_URL => "https://oauth2.googleapis.com/tokeninfo";
# Default OAuth2 scope for Google Ads API.
use constant DEFAULT_OAUTH2_SCOPE => "https://www.googleapis.com/auth/adwords";
view all matches for this distribution