view release on metacpan or search on metacpan
lib/ANSI/Palette.pm view on Meta::CPAN
background_italic_256 => [qw/all background_italic ansi_256/],
);
sub palette_8 {
print "ANSI palette -> \\e[Nm\n";
for (30..37) {
print "\e[" . $_ . "m " . $_;
}
reset;
}
sub palette_16 {
print "ANSI palette -> \\e[Nm\n";
for (30..37) {
print "\e[" . $_ . "m " . $_;
}
print "\nANSI palette -> \\e[N;1m\n";
for (30..37) {
print "\e[" . $_ . ";1m " . $_;
}
reset;
}
sub palette_256 {
print "ANSI palette -> \\e[38;5;Nm\n";
for my $i (0..15) {
for my $j (0..16) {
my $code = $i * 16 + $j;
print "\e[38;5;" . $code . "m " . $code;
}
print "\n";
}
reset;
}
sub text_8 {
print "\e[" . $_[0] . "m" . $_[1];
reset();
}
sub text_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . "m" . $_[2];
reset();
}
sub text_256 {
print "\e[38;5;" . $_[0] . "m" . $_[1];
reset();
}
sub bold_8 {
print "\e[" . $_[0] . ";1m" . $_[1];
reset();
}
sub bold_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";1m" . $_[2];
reset();
}
sub bold_256 {
print "\e[38;5;" . $_[0] . ";1m" . $_[1];
reset();
}
sub underline_8 {
print "\e[" . $_[0] . ";4m" . $_[1];
reset();
}
sub underline_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";4m" . $_[2];
reset();
}
sub underline_256 {
print "\e[38;5;" . $_[0] . ";4m" . $_[1];
reset();
}
sub italic_8 {
print "\e[" . $_[0] . ";3m" . $_[1];
reset();
}
sub italic_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : "") . ";3m" . $_[2];
reset();
}
sub italic_256 {
print "\e[38;5;" . $_[0] . ";3m" . $_[1];
reset();
}
sub background_text_8 {
print "\e[" . $_[0] . ";" . $_[1] . "m" . $_[2];
reset();
}
sub background_text_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . "m" . $_[3];
reset();
}
sub background_text_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . "m" . $_[2];
reset();
}
sub background_bold_8 {
print "\e[" . $_[0] . ";" . $_[1] . ";1m" . $_[2];
reset();
}
sub background_bold_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . ";1m" . $_[3];
reset();
}
sub background_bold_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";1m" . $_[2];
reset();
}
sub background_underline_8 {
print "\e[" . $_[0] . ";" . $_[1] . ";4m" . $_[2];
reset();
}
sub background_underline_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ';' . $_[2] . ";4m" . $_[3];
reset();
}
sub background_underline_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";4m" . $_[2];
reset();
}
sub background_italic_8 {
print "\e[" . $_[0] . ";" . $_[1] . ";3m" . $_[2];
reset();
}
sub background_italic_16 {
print "\e[" . $_[0] . ($_[1] ? ";1" : ";0") . ";" . $_[2] . ";3m" . $_[3];
reset();
}
sub background_italic_256 {
print "\e[48;5;" . $_[0] . ";38;5;" . $_[1] . ";3m" . $_[2];
reset();
}
sub reset { print "\e[0m"; }
__END__
1;
lib/ANSI/Palette.pm view on Meta::CPAN
=cut
=head2 palette_8
prints a font color palette containing the 8 base colors
\e[Nm
31 32 33 34 35 36 37
=cut
=head2 palette_16
prints a font color palette containing the 8 base colors and the bright variation.
\e[Nm
30 31 32 33 34 35 36 37
\e[N;1m
30 31 32 33 34 35 36 37
=cut
=head2 palette_256
prints a font color palette containing the extended 256 terminal colour codes.
\e[38;5;Nm
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
lib/ANSI/Palette.pm view on Meta::CPAN
=cut
=head2 text_8
print text using one of the 8 base colors.
text_8(32, "This is a test for text_8\n");
=cut
=head2 text_16
print text using one of the 16 base colors.
text_16(32, 1, "This is a test for text_16\n");
=cut
=head2 text_256
print text using one of the 256 base colors.
text_256(32, "This is a test for text_256\n");
=cut
=head2 bold_8
print bold text using one of the 8 base colors.
bold_8(32, "This is a test for bold_8\n");
=cut
=head2 bold_16
print bold text using one of the 16 base colors.
bold_16(32, 1, "This is a test for bold_16\n");
=cut
=head2 bold_256
print bold text using one of the 256 base colors.
bold_256(32, "this is a test for bold_256\n");
=cut
=head2 underline_8
print underlined text using one of the 8 base colors.
underline_8(32, "This is a test for underline_8\n");
=cut
=head2 underline_16
print underlined text using one of the 16 base colors.
underline_16(32, 1, "This is a test for underline_16\n");
=cut
=head2 underline_256
print underlined text using one of the 256 base colors.
underline_256(32, "This is a test for underline_256\n");
=cut
=head2 italic_8
print italic text using one of the 8 base colors.
italic_8(32, "This is a test for italic_8\n");
=cut
=head2 italic_16
print italic text using one of the 16 base colors.
italic_16(32, 1, "This is a test for italic_16\n");
=cut
=head2 italic_256
print italic text using one of the 256 base colors.
italic_256(32, "This is a test for italic_256\n");
=cut
=head2 background_text_8
print text using one of the 8 base colors on a background using one of the 8 base colors.
background_text_8(32, 40, "This is a test for background_text_8\n");
=cut
=head2 background_text_16
print text using one of the 16 base colors on a background using one of the 16 base colors (40-47) (100-107).
background_text_16(32, 1, 41, "This is a test for background_text_16\n");
=cut
=head2 background_text_256
print text using one of the 256 base colors on a background using one of the 256 base colors.
background_text_256(208, 33, "This is a test for background_text_256\n");
=cut
=head2 background_bold_8
print bold text using one of the 8 base colors on a background using one of the 8 base colors.
background_bold_8(32, 40, "This is a test for background_bold_8\n");
=cut
=head2 background_bold_16
print bold text using one of the 16 base colors on a background using one of the 16 base colors (40-47) (100-107).
background_bold_16(32, 1, 40, "This is a test for background_bold_16\n");
=cut
=head2 background_bold_256
print bold text using one of the 256 base colors on a background using one of the 256 base colors.
background_bold_256(208, 33, "this is a test for background_bold_256\n");
=cut
=head2 background_underline_8
print underlined text using one of the 8 base colors on a background using one of the 8 base colors.
background_underline_8(32, 40, "This is a test for background_underline_8\n");
=cut
=head2 background_underline_16
print underlined text using one of the 16 base colors using one of the 16 base colors (40-47) (100-107).
background_underline_16(32, 1, 40, "This is a test for background_underline_16\n");
=cut
=head2 background_underline_256
print underlined text using one of the 256 base colors on a background using one of the 256 base colors.
background_underline_256(208, 33, "This is a test for background_underline_256\n");
=cut
=head2 background_italic_8
print italic text using one of the 8 base colors on a background using one of the 8 base colors.
background_italic_8(32, 40, "This is a test for background_italic_8\n");
=cut
=head2 italic_16
print italic text using one of the 16 base colors on a background using one of the 16 base colors (40-47) (100-107).
background_italic_16(32, 1, 40, "This is a test for background_italic_16\n");
=cut
=head2 italic_256
print italic text using one of the 256 base colors on a background using on the 256 base colors.
background_italic_256(32, "This is a test for background_italic_256\n");
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
$SFLAP_KEEPALIVE = 5;
sub register_callback {
my ($self, $chan, $func, @args) = @_;
#print "register_callback() func $func for chan $chan adding to $self->{callback}{$chan}\n";
#print " self $self selfcb = $self->{callback}\n";
push (@{$self->{callback}{$chan}}, $func);
@{$self->{callback}{$func}} = @args;
return;
sub clear_callbacks {
my ($self) = @_;
my $k;
print "...............C SFLAP clear_callbacks\n";
for $k (keys %{$self->{callback}}) {
print ".............C Clear key ($k)\n";
delete $self->{callback}{$k};
}
print "...............S SFLAP scan callbacks\n";
for $k (keys %{$self->{callback}}) {
print ".............S Scan key ($k)\n";
}
}
sub callback {
my ($self, $chan, @args) = @_;
my $func;
for $func (@{$self->{callback}{$chan}}) {
#print ("callback() calling a func $func for $chan fd $self->{fd}..\n");
eval { &{$func} ($self, @args, @{$self->{callback}{$func}}) };
}
return;
}
}
sub destroy {
my ($self) = @_;
print "sflap destroy\n";
CORE::close($self->{fd});
$self = undef;
return;
sub close {
my ($self) = @_;
my $k;
print "sflap close\n";
$self->clear_callbacks();
#CORE::close($self->{fd});
sub set_debug {
my ($self, $level) = @_;
$self->{debug_level} = $level;
print "slfap debug level $level\n";
}
sub debug {
my ($self, @args) = @_;
if (exists $self->{debug_level} && $self->{debug_level} > 0) {
print @args;
}
}
sub __connect {
my ($self) = @_;
my ($buffer, $from, $xfrom) = '';
my ($fd) = $self->{fd};
$foo = CORE::sysread($fd, $buffer, 6);
if ($foo <= 0) {
#print "recv failed! calling signoff....\n";
$self->callback($SFLAP_SIGNOFF);
return;
}
my ($id, $chan, $seq, $len, $data) = unpack("aCnn", $buffer);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
my $out = $conn->send_cmds(<<EOT);
info tclversion
EOT
print $out, "\n";
=head1 DESCRIPTION
C<AOLserver::CtrlPort> uses C<Net::Telnet> to connect to a running
AOLserver's control port, issues commands there and returns the
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Assembla.pm view on Meta::CPAN
my ($self, $id) = @_;
my $req = $self->make_req('/spaces/'.$id);
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $space = $xp->find('/space')->pop;
my $name = $space->findvalue('name')."";
lib/API/Assembla.pm view on Meta::CPAN
my ($self) = @_;
my $req = $self->make_req('/spaces/my_spaces');
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $spaces = $xp->find('/spaces/space');
lib/API/Assembla.pm view on Meta::CPAN
my ($self, $id, $number) = @_;
my $req = $self->make_req('/spaces/'.$id.'/tickets/'.$number);
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $ticket = $xp->find('/ticket')->pop;
lib/API/Assembla.pm view on Meta::CPAN
my ($self, $id) = @_;
my $req = $self->make_req('/spaces/'.$id.'/tickets');
my $resp = $self->_client->request($req);
# print STDERR $resp->decoded_content;
my $xp = XML::XPath->new(xml => $resp->decoded_content);
my $tickets = $xp->find('/tickets/ticket');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Basecamp.pm view on Meta::CPAN
=head2 debug
$basecamp->debug;
$basecamp->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$basecamp->fatal;
$basecamp->fatal(1);
view all matches for this distribution
view release on metacpan or search on metacpan
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CLI/Cmd.pm view on Meta::CPAN
if (defined $outfile) {
DumpFile($outfile, $appspec);
say "Wrote appspec to $outfile";
}
else {
print Dump $appspec;
}
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DeutscheBahn/Fahrplan.pm view on Meta::CPAN
my ( $method, $path ) = @{$definition}{qw(method path)};
# add path parameters
for ( @{ $definition->{path_parameters} } ) {
my $value = $args{$_};
croak sprintf 'Missing path parameter: %s', $_ unless $value;
$path .= "/${value}";
}
# set the uri path including the path set in the base url
$uri->path( $uri->path . $path );
lib/API/DeutscheBahn/Fahrplan.pm view on Meta::CPAN
if ( my $value = $args{$param} ) {
$uri->query_param( $param => $value );
}
# check if param is required
elsif ( $definition->{query_parameters}->{$param} ) {
croak sprintf 'Missing query parameter: %s', $param;
}
}
return ( lc $method, $uri );
lib/API/DeutscheBahn/Fahrplan.pm view on Meta::CPAN
sub _build_client {
my $self = $_[0];
my @args;
push @args, 'Authorization' => sprintf( 'Bearer %s', $self->access_token )
if $self->access_token;
return HTTP::Tiny->new(
default_headers => {
'Accept' => 'application/json',
'User-Agent' => sprintf( 'Perl-%s::%s', __PACKAGE__, $VERSION ),
@args,
},
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DirectAdmin.pm view on Meta::CPAN
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';
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-load.t view on Meta::CPAN
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'API::Drip::Request' ) || print "Bail out!\n";
}
diag( "Testing API::Drip::Request $API::Drip::Request::VERSION, Perl $], $^X" );
view all matches for this distribution
view release on metacpan or search on metacpan
examples/edw/Rest.pl view on Meta::CPAN
# get local IP
if ( !defined $h_setup{ip} || !length $h_setup{ip} ) {
my $response = HTTP::Tiny->new->get('http://monip.org/');
unless ( $response->{success} ) {
print STDERR "\tunable to reach external network to get IP address.\n";
exit(1);
}
($h_setup{ip}) = ($response->{content} =~ /IP\s:\s(\d+\.\d+\.\d+\.\d+)/gm);
}
foreach my $p ( qw/ grid ip token site query / ) {
if ( !defined $h_setup{$p} || !length $h_setup{$p} ) {
print STDERR "\tmissing $p parameter, check help.\n";
exit(1);
}
}
delete $h_setup{$_} for ( qw/ site query / );
# get query to send
my $qfile = './examples/edw/sql/'.$query.'.sql';
if ( !-e $qfile ) {
print STDERR "\trequested query $query does not exists.\n";
exit(1);
}
my $date_from = time() - 24 * 3600;
my $date_to = time();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Facebook.pm view on Meta::CPAN
=head2 debug
$facebook->debug;
$facebook->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$facebook->fatal;
$facebook->fatal(1);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/git/nuke_forge_fork.pm view on Meta::CPAN
= grep !/\Agitforge\z/,
map { m#refs/heads/#; $' } $git->ls_remote(qw(--heads fork));
if (@fork_branches) {
say "Would delete the following branches:";
say " $_" for @fork_branches;
print "\n";
exit unless $term->ask_yn(prompt => "Are you sure?");
}
my ($forge_domain, $upstream_repo) = remote_forge_info $upstream;
my $forge = new_from_domain
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Github.pm view on Meta::CPAN
=head2 debug
$github->debug;
$github->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$github->fatal;
$github->fatal(1);
view all matches for this distribution
view release on metacpan or search on metacpan
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Handle.pm view on Meta::CPAN
require Nour::Config;
return new Nour::Config ( -base => 'config' );
}
);
has _printer => (
is => 'rw'
, isa => 'Nour::Printer'
, handles => [ qw/verbose debug info warn warning error fatal dumper/ ]
, required => 1
, lazy => 1
, default => sub {
my $self = shift;
my %conf = $self->config->{printer} ? %{ $self->config->{printer} } : (
timestamp => 1
, verbose => 1
, dumper => 1
, debug => 1
, pid => 1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/INSEE/Sirene.pm view on Meta::CPAN
}
sub _dumpRequest {
my ($self, $request, $response) = @_;
my $dump = sprintf "Sent request:\n%s\n", $request->as_string;
$dump .= sprintf "Received response:\n%s\n", $response->as_string if defined $response;
return $dump;
}
sub _initUserAgent {
lib/API/INSEE/Sirene.pm view on Meta::CPAN
switch ($response->code) {
case [ HTTP_OK, HTTP_NOT_FOUND ] {
return 0, $response->content;
}
case HTTP_MOVED_PERMANENTLY { # duplicated legal unit/ establishment
return 1, sprintf "%s\n%s", $response->message, $response->header('Location');
}
case [
HTTP_REQUEST_URI_TOO_LARGE, HTTP_TOO_MANY_REQUESTS,
HTTP_UNAUTHORIZED, HTTP_FORBIDDEN,
HTTP_SERVICE_UNAVAILABLE
lib/API/INSEE/Sirene.pm view on Meta::CPAN
my $parameters = {
date => strftime('%Y-%m-%d', localtime),
nombre => $self->{'max_results'},
};
$parameters->{'champs'} = $self->_buildFields($usefull_fields, $desired_fields) if (defined $desired_fields && $desired_fields ne 'all');
$parameters->{'q'} = sprintf('(%s)', $criteria) if defined $criteria;
return $parameters;
}
sub _buildFields {
lib/API/INSEE/Sirene.pm view on Meta::CPAN
my @criteria;
my @words = split /[ \/-]/, $value;
foreach my $word (@words) {
$word =~ s/&/%26/ig;
$word = sprintf '(%s:"%s"~ OR %s:*%s*)', $field_name, $word, $field_name, $word;
$word = "periode$word" if any { $_ eq $field_name } @{ $historized_fields->{$self->{'current_endpoint'}} };
push @criteria, $word;
}
lib/API/INSEE/Sirene.pm view on Meta::CPAN
my $criteria;
$value =~ s/&/%26/ig;
if ($search_mode eq 'exact') {
$criteria = sprintf '%s:%s', $field_name, $value;
}
elsif ($search_mode eq 'begin') {
$criteria = sprintf '%s:%s*', $field_name, $value;
}
$criteria = "periode($criteria)" if any { $_ eq $field_name } @{ $historized_fields->{$self->{'current_endpoint'}} };
return $criteria;
view all matches for this distribution
view release on metacpan or search on metacpan
add_database.pl view on Meta::CPAN
dbconfirm => $db_pass,
} );
if ($db_creation_result) {
print "$db_name success added!\n";
} else {
warn Dumper($API::ISPManager::last_answer);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Instagram.pm view on Meta::CPAN
$uri->query_form($params);
$url = $uri->as_string;
}
# For debugging purposes
print "Requesting: $url$/" if $self->_debug;
# Treats response content
my $res = decode_json $self->_ua->$method( $url, [], $params )->decoded_content;
# Verifies meta node
lib/API/Instagram.pm view on Meta::CPAN
my $my_user = $instagram->user;
my $feed = $my_user->feed( count => 5 );
for my $media ( @$feed ) {
printf "Caption: %s\n", $media->caption;
printf "Posted by %s at %s (%d likes)\n\n", $media->user->username, $media->created_time, $media->likes;
}
=head1 DESCRIPTION
lib/API/Instagram.pm view on Meta::CPAN
scope => 'basic',
response_type => 'code',
granty_type => 'authorization_code',
});
print $instagram->get_auth_url;
=head3 Authenticate
After authorization, Instagram will redirected the user to the URL in
C<redirect_uri> with a code as an URL query parameter. This code is needed
lib/API/Instagram.pm view on Meta::CPAN
With the access token its possible to do Instagram API requests using the
authenticated user credentials.
$instagram->access_token( $access_token );
my $me = $instagram->user;
print $me->full_name;
=head1 METHODS
=head2 new
lib/API/Instagram.pm view on Meta::CPAN
this feature setting a true value to C<no_chace> parameter.
=head2 instance
my $instagram = API::Instagram->instance;
print $instagram->user->full_name;
or
my $instagram = API::Instagram->instance({
client_id => $client_id,
lib/API/Instagram.pm view on Meta::CPAN
Note: if no instance was created before, creates a new L<API::Instagram> object initialized with arguments provided and then returns it.
=head2 get_auth_url
my $auth_url = $instagram->get_auth_url;
print $auth_url;
Returns an Instagram authorization URL.
=head2 get_access_token
lib/API/Instagram.pm view on Meta::CPAN
See L<API::Instagram::Search> for more details and examples.
=head2 popular_medias
my $medias = $user->popular_medias( count => 3 );
print $_->caption . $/ for @$medias;
Returns a list of L<API::Instagram::Media> objects of Instagram most popular media at the moment.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
API/Intis/LICENSE view on Meta::CPAN
part contains or is derived from the Program or any part thereof, to be licensed
as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you
must cause it, when started running for such interactive use in the most ordinary
way, to print or display an announcement including an appropriate copyright
notice and a notice that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these conditions,
and telling the user how to view a copy of this License. (Exception: if the
Program itself is interactive but does not normally print such an announcement,
your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
view all matches for this distribution
view release on metacpan or search on metacpan
t/author-critic.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Mathpix.pm view on Meta::CPAN
my $response = $mathpix->process({
src => 'https://mathpix.com/examples/limit.jpg',
});
print $response->text;
=head1 EXPORT
A list of functions that can be exported. You can delete this section
view all matches for this distribution
view release on metacpan or search on metacpan
example/hello_medium.pl view on Meta::CPAN
use utf8;
use API::Medium;
my $token = $ARGV[0];
print "Usage: $0 your_access_token\n" && exit unless $token;
my $m = API::Medium->new( { access_token => $token, } );
my $user = $m->get_current_user;
example/hello_medium.pl view on Meta::CPAN
"publishStatus" => "draft",
#"canonicalUrl": "http://example.com/it-works.html",
}
);
print "Your post is ready: $post_url\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/MikroTik.pm view on Meta::CPAN
my $api = API::MikroTik->new();
# Blocking
my $list = $api->command(
'/interface/print',
{'.proplist' => '.id,name,type'},
{type => ['ipip-tunnel', 'gre-tunnel'], running => 'true'}
);
if (my $err = $api->error) { die "$err\n" }
printf "%s: %s\n", $_->{name}, $_->{type} for @$list;
# Non-blocking
my $tag = $api->command(
'/system/resource/print',
{'.proplist' => 'board-name,version,uptime'} => sub {
my ($api, $err, $list) = @_;
...;
}
);
lib/API/MikroTik.pm view on Meta::CPAN
}
);
Mojo::IOLoop->start();
# Promises
$api->cmd_p('/interface/print')
->then(sub { my $res = shift }, sub { my ($err, $attr) = @_ })
->finally(sub { Mojo::IOLoop->stop() });
Mojo::IOLoop->start();
=head1 DESCRIPTION
lib/API/MikroTik.pm view on Meta::CPAN
Cancels background commands. Can accept a callback as last argument.
=head2 cmd
my $list = $api->cmd('/interface/print');
An alias for L</command>.
=head2 cmd_p
my $promise = $api->cmd_p('/interface/print');
An alias for L</command_p>.
=head2 command
my $command = '/interface/print';
my $attr = {'.proplist' => '.id,name,type'};
my $query = {type => ['ipip-tunnel', 'gre-tunnel'], running => 'true'};
my $list = $api->command($command, $attr, $query);
die $api->error if $api->error;
for (@$list) {...}
$api->command('/user/set', {'.id' => 'admin', comment => 'System admin'});
# Non-blocking
$api->command('/ip/address/print' => sub {
my ($api, $err, $list) = @_;
return if $err;
for (@$list) {...}
});
# Omit attributes
$api->command('/user/print', undef, {name => 'admin'} => sub {...});
# Errors handling
$list = $api->command('/random/command');
if (my $err = $api->error) {
die "Error: $err, category: " . $list->[0]{category};
lib/API/MikroTik.pm view on Meta::CPAN
For a query syntax refer to L<API::MikroTik::Query>.
=head2 command_p
my $promise = $api->command_p('/interface/print');
$promise->then(
sub {
my $res = shift;
...
lib/API/MikroTik.pm view on Meta::CPAN
C<ping>. Should be terminated with L</cancel>.
=head1 DEBUGGING
You can set the API_MIKROTIK_DEBUG environment variable to get some debug output
printed to stderr.
Also, you can change connection timeout with the API_MIKROTIK_CONNTIMEOUT variable.
=head1 COPYRIGHT AND LICENSE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Name.pm view on Meta::CPAN
=head2 debug
$name->debug;
$name->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$name->fatal;
$name->fatal(1);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Octopart.pm view on Meta::CPAN
max_moq => 100,
min_qty => 10,
max_price => 4,
#mfg => 'Murata',
);
print Dumper $o->get_part_stock_detail('RC0805FR-0710KL', %opts);
print Dumper $o->get_part_stock_detail('GQM1555C2DR90BB01D', %opts);
=head1 METHODS
=over 4
lib/API/Octopart.pm view on Meta::CPAN
my $age_days = (-M $hashfile);
if (-e $hashfile && $age_days < $self->{cache_age})
{
if ($self->{ua_debug})
{
print STDERR "Reading from cache file (age=$age_days days): $hashfile\n";
}
if (open(my $in, $hashfile))
{
local $/;
lib/API/Octopart.pm view on Meta::CPAN
{
$ua->add_handler(
"request_send",
sub {
my $msg = shift; # HTTP::Request
print STDERR "SEND >> \n"
. $msg->headers->as_string . "\n"
. "\n";
return;
}
);
$ua->add_handler(
"response_done",
sub {
my $msg = shift; # HTTP::Response
print STDERR "RECV << \n"
. $msg->headers->as_string . "\n"
. $msg->status_line . "\n"
. "\n";
return;
}
lib/API/Octopart.pm view on Meta::CPAN
$response = $ua->request($req);
if (!$response->is_success)
{
$tries++;
print STDERR "query error, retry $tries. "
. $response->code . ": "
. $response->message . "\n";
sleep 2**$tries;
}
else
lib/API/Octopart.pm view on Meta::CPAN
if (!$j->{errors})
{
if ($hashfile)
{
open(my $out, ">", $hashfile) or die "$hashfile: $!";
print $out $content;
close($out);
}
}
else
{
lib/API/Octopart.pm view on Meta::CPAN
if ($self->{json_debug})
{
if ($hashfile)
{
my $age_days = (-M $hashfile);
print STDERR "======= cache: $hashfile (age=$age_days days) =====\n"
}
print STDERR Dumper $j;
}
return $j;
}
view all matches for this distribution
view release on metacpan or search on metacpan
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Plesk.pm view on Meta::CPAN
my $res = $api->customer->get();
if ($res->is_success) {
for ( @{$res->data} ) {
print "login: $_->{login}\n";
}
}
else {
print $res->error;
}
=head1 DESCRIPTION
At present the module provides interaction with Plesk 10.1 (API 1.6.3.1).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/PleskExpand/Accounts.pm view on Meta::CPAN
}, 'API::Plesk::Response' );
Example (client deactivation):
print Dumper $client->Accounts->modify(
id => 10,
general_info => { status => 16 }
);
=cut
lib/API/PleskExpand/Accounts.pm view on Meta::CPAN
'error_codes' => ''
}, 'API::Plesk::Response' );
Example:
print Dumper $client->Accounts->delete( id => 11 );
=back
=cut
view all matches for this distribution