view release on metacpan or search on metacpan
# hooray! we have an identity.
foreach (keys %aisvar){
$Sessions{$Coo}->{$_} = $aisvar{$_};
};
#reconstruct initial form data if any
$ENV{QUERY_STRING} = delete $Sessions{$Coo}->{QueryString};
if(exists $Sessions{$Coo}->{PostData}){
pipe(POSTREAD,POSTWRITE) or die "Cannot create pipe: $!";
if (fork){
# we are in parent
close POSTWRITE;
open STDIN, "<&POSTREAD";
$ENV{REQUEST_METHOD} = 'POST';
}else{
# in child -- write POSTdata to pipe and exit
close STDOUT;
close STDIN;
close POSTREAD;
print POSTWRITE delete $Sessions{$Coo}->{PostData};
close POSTWRITE or die "$$: Error closing POSTWRITE\n";
listed as part of the agent string.
=item prefix
By default, C<AIS>, which means that AIS::client will store session
data (incliding identity, which is also available as
C<$AIS_STASH{identity}>) in subdirectories under a directory
called C<AIS_sessions> under the current directory
your script runs in. This can be changed with the C<prefix> parameter:
use AIS::client prefix => '.AIS'; # hide session directory
=head1 ENDING SESSIONS
AIS::client recognizes a reserved QUERY_STRING of C<LOGOUT> which will
end a session, delete all session data, and offer the user a link to
the logout function of the specified AIS server so they can log out
of that too if they want.
=head1 HISTORY
view all matches for this distribution
view release on metacpan or search on metacpan
LPP/lpp_name.pm view on Meta::CPAN
$x->write(\*out_fh);
or
$x = lpp_name->read(\*in_fh);
my %lppdata = $x->lpp();
my %fsdata = $x->fileset('test.lpp.rte');
my $req_ref = $x->requisites('test.lpp.rte');
my $size_ref = $x->sizeinfo('test.lpp.rte');
=head1 DESCRIPTION
LPP/lpp_name.pm view on Meta::CPAN
object. This object is then modified using lpp() and fileset() object
methods. Basic LPP information can also be passed to new() as follows: ...
=item $x = lpp_name->read(\*in_fh);
Alternatively, a new lpp_name object can be create by reading data from
an lpp_name formatted file. read() is both a class method and an instance
method (or it will be when I'm finished).
=head1 OBJECT METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL
MANIFEST
README
t/AIX-LVM.t
lib/AIX/LVM.pm
META.yml Module meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
example1.pl view on Meta::CPAN
print "disk_count() $num_disks\n";
my $num_netifs = AIX::Perfstat::netinterface_count();
print "netinterface_count() $num_netifs\n";
my $cpu_data = AIX::Perfstat::cpu($num_cpus);
print "cpu($num_cpus) ", Dumper($cpu_data);
my $disk_data = AIX::Perfstat::disk($num_disks);
print "disk($num_disks) ", Dumper($disk_data);
my $netif_data = AIX::Perfstat::netinterface($num_netifs);
print "netinterface($num_netifs) ", Dumper($netif_data);
view all matches for this distribution
view release on metacpan or search on metacpan
$swap =~ /(\d+)\D+/; $hash->{total_swap} = $1;
return 1;
}
sub get_hardware_info {
my $hash = shift @_;
chomp ( my $model_data = `$UNAME -M` );
$model_data =~ /(.*),(.*)/;
( $hash->{sys_arch}, $hash->{model_type} ) = ( $1, $2 );
return 1;
}
sub get_proc_data {
my $hash = shift @_;
$hash->{num_procs} = prtconf_param( '^Number Of Processors:' );
my $speed = prtconf_param( '^Processor Clock Speed:' );
$speed =~ /(\d+)\D+/; $hash->{proc_speed} = $1;
$hash->{proc_type} = prtconf_param( '^Processor Type:' );
&get_hostname ( $s_ref );
&get_aix_version ( $s_ref );
&get_hardware_info( $s_ref );
&get_serial_num ( $s_ref );
&get_proc_data ( $s_ref );
&get_firmware_ver ( $s_ref );
&get_total_ram ( $s_ref );
&get_total_swap ( $s_ref );
&get_lpar_info ( $s_ref );
&get_kernel_type ( $s_ref );
=back
=head1 NOTE
Most of the data is obtained by parsing output of these three AIX commands: B</usr/bin/uname>, B</usr/bin/oslevel>, B</usr/sbin/prtconf>
=head1 VERSION
1.1.1 (released on Wed Jun 17 15:07:35 CDT 2009)
1.1 (released on Tue Jun 16 16:39:00 CDT 2009)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ALBD.pm view on Meta::CPAN
=head1 ABSTRACT
This package consists of Perl modules along with supporting Perl
programs that perform Literature Based Discovery (LBD). The core
data from which LBD is performed are co-occurrences matrices
generated from UMLS::Association. ALBD is based on the ABC
co-occurrence model. Many options can be specified, and many
ranking methods are available. The novel ranking methods that use
association measure are available as well as frequency based
ranking methods. See samples/lbd for more info. Can perform open and
lib/ALBD.pm view on Meta::CPAN
# are an explicit knowledge matrix, which is squared to find the implicit
# knowledge matrix.
#
# The explicit knowledge is read from UMLS::Association N11 matrix. This
# matrix contains the co-occurrence counts for all CUI pairs. The
# UMLS::Association database is completely independent from
# implementation, so any dataset, window size, or anything else may be used.
# Data is read in as a sparse matrix using the Discovery::tableToSparseMatrix
# function. This returns the primary data structures and variables used
# throughtout LBD.
#
# Matrix representation:
# This module uses a matrix representation for LBD. All operations are
# performed either as matrix or vector operations. The core data structure
# are the co-occurrence matrices explicitMatrix and implicitMatrix. These
# matrices have dimensions vocabulary size by vocabulary size. Each row
# corresponds to the all co-occurrences for a single CUI. Each column of that
# row corresponding to a co-occurrence with a single CUI. Since the matrices
# tend to be sparse, they are stored as hashes of hashes, where the the first
# key is for a row, and the second key is for a column. The keys of each hash
# are the indeces within the matrix. The hash values are the number of
# co-ocurrences for that CUI pair (e.g. ${${$explicit{C0000000}}{C1111111} = 10
# means that CUI C0000000 and C1111111 co-occurred 10 times).
#
# Now with an understanding of the data strucutres, below is a breif
# description of each:
#
# startingMatrix <- A matrix containing the explicit matrix rows for all of the
# start terms. This makes it easy to have multiple start terms
# and using this matrix as opposed to the entire explicit
# matrix drastically improves performance.
# explicitMatrix <- A matrix containing explicit connections (known connections)
# for every CUI in the dataset.
# implicitMatrix <- A matrix containing implicit connections (discovered
# connections) for every CUI in the datast
package ALBD;
use strict;
lib/ALBD.pm view on Meta::CPAN
while (my $line = <IN>) {
#check if its a comment or blank line
$firstChar = substr $line, 0, 1;
if ($firstChar ne '#' && $line =~ /[^\s]+/) {
#line contains data, grab the key and value
$line =~ /<([^>]+)>([^\n]*)/;
#make sure the data was read in correctly
if (!$1) {
print STDERR
"Warning: Invalid line in $configFileName: $line\n";
}
else {
#data was grabbed from the line, add to hash
if ($2) {
#add key and value to the optionsHash
$optionsHash{$1} = $2;
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ALPM/Conf.pm view on Meta::CPAN
sub _getdb
{
my($dbs, $name) = @_;
# The order databases are added must be preserved as must the order of URLs.
for my $db (@$dbs){
return $db if($db->{'name'} eq $name);
}
my $new = { 'name' => $name };
push @$dbs, $new;
lib/ALPM/Conf.pm view on Meta::CPAN
next if(!@$mirs);
_expurls($mirs, $opts->{'arch'}, $r);
$sl = 'default' if(!$usesl);
my $x = $alpm->register($r, $sl)
or die "Failed to register $r database: " . $alpm->strerror;
$x->add_server($_) for(@$mirs);
}
return $alpm;
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/amfclient.pl view on Meta::CPAN
$json->ascii(1);
$json->utf8(1);
$json->pretty(1);
$json->allow_blessed(1);
$json->convert_blessed(1);
my $json_data = $json->encode( $response->getData );
if ( $response->is_success ) {
print $json_data;
} else {
die "Can not send remote request for $service.$method method with params on $endpoint using AMF".$client->getEncoding()." encoding:\n".$json_data."\n";
};
view all matches for this distribution
view release on metacpan or search on metacpan
doc/examples/basic/basicservices/DataEcho.pm view on Meta::CPAN
};
}
sub echoNormal
{
my ($self, $data) = @_;
return $data;
}
sub echoDate
{
my ($self, $data) = @_;
return $data;
}
sub echoXML
{
my ($self, $data) = @_;
return $data;
}
#This function will NOT return the value, because the call to amf_throw() will interrupt
#the control flow and cause the _Status function on the client to be called.
sub generateError
{
my ($self, $data) = @_;
amf_throw("An error!!!");
return "No error";
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
t/pod-coverage.t
t/pod.t
t/todo.t
t/critic.t
t/perlcriticrc
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ANSI/Heatmap.pm view on Meta::CPAN
return $self->{swatch};
}
sub to_string {
my $self = shift;
return $self->render($self->data);
}
# Convert heatmap hash to a 2D grid of intensities, normalised between 0 and 1,
# cropped to the min/max range supplied and scaled to the desired width/height.
sub data {
my ($self, $mm) = @_;
my %mm = $self->_figure_out_min_and_max;
my $inv_max_z = $mm{zrange} ? 1 / $mm{zrange} : 0;
my @out;
lib/ANSI/Heatmap.pm view on Meta::CPAN
$map->width(25);
$map->height(25);
$map->swatch('grayscale');
print $map;
my $data = $map->data;
# Mess with the data...
print $map->render($data);
# Custom swatch
$map->swatch([0x10 .. 0x15]);
=head1 DESCRIPTION
Produce cutting-edge ANSI heatmaps using 256 colours and weird Unicode
characters! Perfect for 3D (2D + intensity) data.
=head1 METHODS
=head2 new ( [ARGS] )
lib/ANSI/Heatmap.pm view on Meta::CPAN
using the min_I<axis> and max_I<axis> values to determine the
width/height.
=item interpolate ( BOOL )
If width/height is not a nice multiple of the input data and
this flag is set, perform bilinear interpolation (instead of
nearest neighbour). This is a trade off; interpolated data is
blurrier, but retains a linear relationship with the original
data. Off by default.
=back
=head2 set ( X, Y, Z )
lib/ANSI/Heatmap.pm view on Meta::CPAN
use open OUT => ':utf8';
before printing anything (in this case) to STDOUT.
=head2 data
Returns the heatmap data, cropped, scaled and normalised with
intensity values between 0 and 1.
Expressed as an arrayref of arrayrefs indexed by Y and then
X co-ordinate.
=head2 render ( DATA )
Manually render heatmap data as returned by C<data>. Useful
if you want to do any custom processing.
=head2 swatch ( [ARRAYREF | STRING] )
Set the colour swatch that decided how the heatmap will look.
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-colours.t
t/manifest.t
t/pod-coverage.t
t/pod.t
xt/boilerplate.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
#print "recv failed! calling signoff....\n";
$self->callback($SFLAP_SIGNOFF);
return;
}
my ($id, $chan, $seq, $len, $data) = unpack("aCnn", $buffer);
$self->debug("sflap recv ($self->{fd}) $foo chan = $chan seq = $seq len = $len\n");
$foo = CORE::sysread($fd, $data, $len);
$self->debug(" data = $data\n");
$self->callback($chan, $data);
return $buffer;
}
sub send {
my ($self, $chan, $data, $length) = @_;
my $buffer;
my $format;
if (!$length) {
$length = length($data);
}
if ($chan == $SFLAP_DATA) {
$format = "cCnna*C";
$length ++;
$format = "cCnna*";
}
$self->{sequence} ++;
$buffer = pack($format, 42, $chan, $self->{sequence},
$length, $data, 0);
($id, $ch, $seq, $len, $data, $nuller) = unpack($format, $buffer);
$foo = CORE::syswrite($self->{fd}, $buffer, $length + 6);
$self->debug("sflap send ($self->{fd}) $foo chan = $ch seq = $seq len = $len data = $data\n");
}
sub write {
my ($self, $buffer, $len, $noflap) = @_;
my $fd = $self->{fd};
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
eg/info
lib/AOLserver/CtrlPort.pm
Makefile.PL
MANIFEST
META.yml Module meta-data (added by MakeMaker)
README
t/001.t
t/002.t
view all matches for this distribution
view release on metacpan or search on metacpan
my $api = API::Assembla->new(
username => 'iirobot',
password => $ENV{'TEST_ASSEMBLA_PASS'}
);
my $data = $api->get_spaces;
cmp_ok(scalar(keys($data)), '==', 2, '2 spaces');
ok(exists($data->{PRG}), 'PRG space');
{
my $space = $data->{PRG};
cmp_ok($space->name, 'eq', 'PRG', 'space name');
cmp_ok($space->id, 'eq', 'dhHT8ENtKr4k_1eJe4gwI3', 'space id');
cmp_ok($space->created_at->ymd, 'eq', '2011-06-22', 'space created_at');
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $basecamp->create(%args);
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $basecamp->delete(%args);
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $basecamp->fetch(%args);
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $basecamp->update(%args);
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 accesses
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/BigBlueButton.pm view on Meta::CPAN
return bless $self, $class;
}
sub abstract_request {
my ( $self, $data ) = @_;
my $request = delete $data->{request};
my $checksum = delete $data->{checksum};
confess "Parameter request required!" unless $request;
my $url = $self->{use_https} ? 'https://' : 'http://';
$url .= $self->{server} . '/bigbluebutton/api/' . $request . '?';
if ( scalar keys %{ $data } > 0 ) {
$url .= $self->generate_url_query( $data );
$url .= '&';
}
$url .= 'checksum=' . $checksum;
return $self->request( $url );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CLI.pm view on Meta::CPAN
);
$self->add_auth($REQ);
if ($method =~ m/^(POST|PUT|PATCH|DELETE)$/) {
my $data_file = $opt->{'data-file'};
if (defined $data_file) {
open my $fh, '<', $data_file or die "Could not open '$data_file': $!";
my $data = do { local $/; <$fh> };
close $fh;
$REQ->content($data);
}
}
my ($ok, $out, $content) = $REQ->request;
if (defined $out) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CPanel.pm view on Meta::CPAN
return '' if is_success( $answer ); # ok == no error
return Dumper( $answer->{statusmsg } );
}
# Get data from @_
sub get_params {
my @params = @_;
if (scalar @params == 1 && ref $params[0] eq 'HASH' ) {
return { %{ $params[0] } };
lib/API/CPanel.pm view on Meta::CPAN
return ref $ref;
}
# INTERNAL!!! Check server answer result
# STATIC(data_block)
sub is_success {
my $data_block = shift;
my $want_hash = shift;
if ( $data_block &&
ref $data_block eq 'HASH' &&
(( $data_block->{status} &&
$data_block->{status} eq '1' ) ||
( $data_block->{result} &&
$data_block->{result} eq '1' ))
) {
return 1;
} else {
return $want_hash ? {} : '';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Client.pm view on Meta::CPAN
$url->path(join '/', $url->path, $path) if $path;
$url->query($url->query->merge(%$query)) if keys %$query;
my @args;
# data handlers
for my $type (sort keys %{$ua->transactor->generators}) {
push @args, $type, delete $args{$type} if $args{$type};
}
# handle raw body value
lib/API/Client.pm view on Meta::CPAN
# log activity
if ($req && $res) {
my $log = $self->logger;
my $msg = join " ", "attempt", ("#".($i+1)), ": $method", $url->to_string;
$log->debug("req: $msg")->data({
request => $req->to_string =~ s/\s*$/\n\n\n/r
});
$log->debug("res: $msg")->data({
response => $res->to_string =~ s/\s*$/\n\n\n/r
});
# output to the console where applicable
$log->info("res: $msg [@{[$res->code]}]");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DeutscheBahn/Fahrplan.pm view on Meta::CPAN
my $fahrplan_free = API::DeutscheBahn::Fahrplan->new;
my $fahrplan_plus = API::DeutscheBahn::Fahrplan->new( access_token => $access_token );
$data = $fahrplan->location( name => 'Berlin' );
$data = $fahrplan->arrival_board( id => 8503000, date => '2018-09-24T11:00:00' );
$data = $fahrplan->departure_board( id => 8503000, date => '2018-09-24T11:00:00' );
$data = $fahrplan->journey_details( id => '87510%2F49419%2F965692%2F453678%2F80%3fstation_evaId%3D850300' );
=head1 DESCRIPTION
API::DeutscheBahn::Fahrplan provides a simple interface to the Deutsche Bahn Fahrplan
API. See L<https://developer.deutschebahn.com/> for further information.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DirectAdmin.pm view on Meta::CPAN
ip => 'IP.ADD.RE.SS',
});
=item delete
Delete DirectAdmin user and all user's data
Note: Some DirectAdmin's API methods required parameter "select0" for choose value from list. Like list of users, databases, ip, etc.
Example:
my $result = $da->user->delete( {
select0 => 'username',
lib/API/DirectAdmin.pm view on Meta::CPAN
=back
=head2 API::DirectAdmin::Mysql
Control users mysql databases
=over
=item list
List of databases from user. Return empty array if databases not found.
Example:
print $da->mysql->list();
=item adddb
Add database to user. Prefix "username_" will be added to 'name' and 'user';
Example:
my %auth = (
auth_user => 'admin_name|customer',
lib/API/DirectAdmin.pm view on Meta::CPAN
passwd2 => 'password',
} );
=item deldb
Delete selected database from user.
Example:
my $result = $da->mysql->deldb({ select0 => 'database_name' });
=back
=head2 API::DirectAdmin::Ip
view all matches for this distribution
view release on metacpan or search on metacpan
bin/drip_client.pl view on Meta::CPAN
=item B<-conf>
Specify the location of a configuration file. Otherwise, defaults to location
specified in the DRIP_CLIENT_CONF environment variable or ~/.drip.conf. Data
in the configuration file must be encoded in YAML format. See
L<API::Drip::Request/"CONFIGURATION"> for the specific data that may be stored.
Each configuration item may also be overriden by setting an environment
variable with the same name.
=back
bin/drip_client.pl view on Meta::CPAN
=head1 DESCRIPTION
B<drip_client.pl> is a command-line interface to the API::Drip library. It's
a handy way to verify your connection to Drip is working as expected, and
possibly to do some light-weight manipulation of your data.
=cut
use v5.14;
use strict;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/edw/Rest.pl view on Meta::CPAN
Print a brief help message and exists
=item B<--grid>
Name of the grid on which your data is hosted.
=item B<--ip>
The IP from which the call is going to be made and that will reach the EDW server.
If not provided, will try to guess it through an external call.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Facebook.pm view on Meta::CPAN
$facebook->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $facebook->create(%args);
lib/API/Facebook.pm view on Meta::CPAN
$facebook->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $facebook->delete(%args);
lib/API/Facebook.pm view on Meta::CPAN
$facebook->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $facebook->fetch(%args);
lib/API/Facebook.pm view on Meta::CPAN
$facebook->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $facebook->update(%args);
lib/API/Facebook.pm view on Meta::CPAN
$facebook->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 achievement
view all matches for this distribution
view release on metacpan or search on metacpan
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Github.pm view on Meta::CPAN
$github->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $github->create(%args);
lib/API/Github.pm view on Meta::CPAN
$github->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $github->delete(%args);
lib/API/Github.pm view on Meta::CPAN
$github->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $github->fetch(%args);
lib/API/Github.pm view on Meta::CPAN
$github->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $github->update(%args);
lib/API/Github.pm view on Meta::CPAN
$github->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 emojis
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Google/GCal.pm view on Meta::CPAN
}
sub add_event {
my ($self, $user, $calendar_id, $event_data) = @_;
$self->api_query({
method => 'post',
route => $self->{api_base}.'/calendars/'.$calendar_id.'/events',
user => $user
}, $event_data);
}
sub busy_time_ranges {
lib/API/Google/GCal.pm view on Meta::CPAN
$gapi->get_calendars($user);
$gapi->get_calendars($user, ['id', 'summary']); # return only specified fields
$gapi->get_calendar_id_by_name($user, 'Contacts');
my $event_data = {};
$event_data->{summary} = 'Exibition';
$event_data->{description} = 'Amazing cats exibition';
$event_data->{location} = 'Angels av. 13';
$event_data->{start}{dateTime} = DateTime::Format::RFC3339->format_datetime($event_start); # '2016-11-11T09:00:00+03:00' format
$event_data->{end}{dateTime} = DateTime::Format::RFC3339->format_datetime($event_end);
$event_data->{start}{timeZone} = $event_data->{end}{timeZone} = $timeZone; # not obligatory
$gapi->add_event($user, $calendar_id, $event_data);
my $freebusy_data = {
user => $user,
calendarId => $calendar_id,
dt_start => DateTime::Format::RFC3339->format_datetime($event_start),
dt_end => DateTime::Format::RFC3339->format_datetime($event_end),
timeZone => 'Europe/Moscow'
};
$gapi->busy_time_ranges($freebusy_data);
$gapi->events_list($freebusy_data);
=head2 get_calendars
Get all calendars of particular Google account
lib/API/Google/GCal.pm view on Meta::CPAN
Get calendar id by its name. Name = "summary" parameter
=head2 add_event
$gapi->add_event($user, $calendar_id, $event_data)
# https://developers.google.com/google-apps/calendar/v3/reference/events/insert
=head2 busy_time_ranges
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Handle.pm view on Meta::CPAN
require Nour::Printer;
return new Nour::Printer ( %conf );
}
);
has _database => (
is => 'rw'
, isa => 'Nour::Database'
, required => 1
, lazy => 1
, default => sub {
my $self = shift;
my %conf = $self->config->{database} ? %{ $self->config->{database} } : (
# default options here
);
%conf = ();
require Nour::Database;
return new Nour::Database ( %conf );
lib/API/Handle.pm view on Meta::CPAN
$self->ua->add_handler(
request_prepare => sub {
my ( $req, $ua, $h ) = @_;
# Set Content-Length header.
if ( my $data = $req->content ) {
$req->headers->header( 'Content-Length' => $self->_bytes( $data ) );
}
}
);
}
sub req {
my ( $self, %args ) = @_;
my $req = new HTTP::Request;
$args{content} ||= $args{data} ||= $args{body};
$args{method} ||= $args{type};
$args{uri} ||= $self->_join_uri( $args{path} );
# Preserve hash order. Maybe needed for SOAP.
if ( defined $args{content} and (
lib/API/Handle.pm view on Meta::CPAN
)
) {
$self->_tied( ref => \%args, key => 'content', tied => 1 );
}
# Leave it up to the API implementation to encode the hash/array ref into JSON / Form data / XML / etc.
$req->content( $args{content} ) if defined $args{content};
$req->method( $args{method} ) if defined $args{method};
$req->uri( $args{uri} );
my $res = $self->ua->request( $req );
lib/API/Handle.pm view on Meta::CPAN
return wantarray ? ( $res, $req ) : $res;
}
sub db {
my ( $self, @args ) = @_;
$self->_database->switch_to( @args ) if @args;
return $self->_database;
}
# TODO: change all references to ->_encode to use ->encode and rename sub-routines
# TODO: same for _decode
sub _encode {
my ( $self, %args ) = @_;
my ( $data );
for ( $args{type} ) {
when ( 'json' ) {
$data = $self->_json->encode( $args{data} );
}
when ( 'xml' ) {
$data = $self->_xml->write( $args{data} );
}
when ( 'form' ) {
require URI;
my $uri = URI->new('http:');
$uri->query_form( ref $args{data} eq "HASH" ? %{ $args{data} } : @{ $args{data} } );
$data = $uri->query;
$data =~ s/(?<!%0D)%0A/%0D%0A/g if defined $data;
}
}
return $data;
}
sub _decode {
my ( $self, %args ) = @_;
my ( $data );
for ( $args{type} ) {
when ( 'json' ) {
$data = $self->_json->decode( $args{data} );
}
when ( 'xml' ) {
$data = $self->_xml->parse( $args{data} );
}
}
return $data;
}
sub _bytes {
my ( $self, $data ) = @_;
return length $data;
}
# A method that will let us write readable requests insteadOfCamelCase.
# Helpful for Google SOAP APIs. See ./t/02-google-dfp.t for example.
sub _camelize {
my $self = shift;
my $data = shift;
$data->{ lcfirst camelize $_ } = delete $data->{ $_ } for keys %{ $data };
for my $data ( values %{ $data } ) {
for ( ref $data ) {
when ( 'ARRAY' ) {
for my $data ( @{ $data } ) {
$self->_camelize( $data ) if ref $data eq 'HASH';
}
}
when ( 'HASH' ) {
$self->_camelize( $data );
}
}
}
}
sub _decamelize {
my $self = shift;
my $data = shift;
my %args = @_;
delete $data->{ $_ } # delete -xmlns and other attrs... why not?
for grep { $_ =~ /^-/ } keys %{ $data };
for ( keys %{ $data } ) {
$data->{ decamelize $_ } = delete $data->{ $_ };
}
for my $data ( values %{ $data } ) {
for ( ref $data ) {
when ( 'ARRAY' ) {
for my $data ( @{ $data } ) {
$self->_decamelize( $data, %args ) if ref $data eq 'HASH';
}
}
when ( 'HASH' ) {
$self->_decamelize( $data, %args );
}
}
}
}
lib/API/Handle.pm view on Meta::CPAN
version 0.02
=head3 _tied
Recursively tie \[ key => $val, key => $val, ... ] data to create preserved-order hashes ( needed for SOAP ).
=head1 AUTHOR
Nour Sharabash <amirite@cpan.org>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/INSEE/Sirene.pm view on Meta::CPAN
=head1 DESCRIPTION
This module allows you to interact with the Sirene API of INSEE (Institut National de la Statistique et des Ãtudes Ãconomiques) in France.
It contains a set of functions that can perform searches on INSEE's database to get some information about french companies like their SIREN number, company name, company headquarters address, etc.
The terms "enterprise", "legal unit" and "establishment" used in this documentation are defined at the INSEE website in the following pages:
=over 4
view all matches for this distribution