view release on metacpan or search on metacpan
lib/API/Twitter.pm view on Meta::CPAN
);
has oauth_type => (
is => 'rw',
isa => Str,
default => 'protected resource',
required => 0,
);
# DEFAULTS
has '+identifier' => (
default => 'API::Twitter (Perl)',
required => 0,
);
has '+url' => (
default => $DEFAULT_URL,
required => 0,
);
has '+version' => (
default => 1.1,
required => 0,
);
# CONSTRUCTION
lib/API/Twitter.pm view on Meta::CPAN
my $req = $tx->req;
my $headers = $req->headers;
my $params = $req->params->to_hash;
my $url = $req->url;
# default headers
$headers->header('Content-Type' => 'application/json');
# append path suffix
$url->path("@{[$url->path]}.json") if $url->path !~ /\.json$/;
lib/API/Twitter.pm view on Meta::CPAN
$twitter->retries;
$twitter->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 1.
=head2 timeout
$twitter->timeout;
$twitter->timeout(5);
The timeout attribute determines how long an HTTP connection should be kept
alive. This attribute defaults to 10.
=head2 url
$twitter->url;
$twitter->url(Mojo::URL->new('https://api.twitter.com'));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Wunderlist.pm view on Meta::CPAN
);
# DEFAULTS
has '+identifier' => (
default => 'API::Wunderlist (Perl)',
required => 0,
);
has '+url' => (
default => $DEFAULT_URL,
required => 0,
);
has '+version' => (
default => 1,
required => 0,
);
# CONSTRUCTION
lib/API/Wunderlist.pm view on Meta::CPAN
method PREPARE ($ua, $tx, %args) {
my $headers = $tx->req->headers;
my $url = $tx->req->url;
# default headers
$headers->header('X-Client-ID' => $self->client_id);
$headers->header('X-Access-Token' => $self->access_token);
$headers->header('Content-Type' => 'application/json');
}
lib/API/Wunderlist.pm view on Meta::CPAN
$wunderlist->retries;
$wunderlist->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 0.
=head2 timeout
$wunderlist->timeout;
$wunderlist->timeout(5);
The timeout attribute determines how long an HTTP connection should be kept
alive. This attribute defaults to 10.
=head2 url
$wunderlist->url;
$wunderlist->url(Mojo::URL->new('https://a.wunderlist.com'));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APISchema/Generator/Markdown.pm view on Meta::CPAN
my $route = $_;
my $req = resolve_encoding($route->request_resource);
my $request_resource = $route->canonical_request_resource($root);
my $codes = $route->responsible_codes;
my $default_code = $route->default_responsible_code;
my $response_resource = $route->canonical_response_resource($root, [
$default_code
]);
my $res = $_->response_resource;
$res = $_->responsible_code_is_specified
? { map { $_ => resolve_encoding($res->{$_}) } @$codes }
lib/APISchema/Generator/Markdown.pm view on Meta::CPAN
),
),
res => $self->{response_example}->(
$renderer,
$route,
$default_code,
APISchema::Generator::Markdown::ExampleFormatter->new(
resolver => $resolver,
spec => $response_resource,
),
),
lib/APISchema/Generator/Markdown.pm view on Meta::CPAN
? if (scalar @$properties) {
|Property|Type|Default|Example|Restrictions|Description|
|--------|----|-------|-------|------------|-----------|
? for my $prop (@$properties) {
? my $def = $prop->{definition};
|`<?= $prop->{path} ?>` |<?= type($def) ?> |<?= code($def->{default}) ?> |<?= code($def->{example}, exists $def->{example}) ?> |<?= restriction($def) ?> |<?= desc($def->{description}) ?> |
? } # $prop
? } # scalar @$properties
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APNS/Agent.pm view on Meta::CPAN
require Getopt::Long;
require Pod::Usage;
require Hash::Rename;
my $p = Getopt::Long::Parser->new(
config => [qw/posix_default no_ignore_case auto_help pass_through bundling/]
);
$p->getoptionsfromarray(\@argv, \my %opt, qw/
certificate=s
private-key=s
disconnect-interval=i
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
#OR
use APP::REST::RestTestSuite;
# overrides the default config and log file paths
my $suite = APP::REST::RestTestSuite->new(
REST_CONFIG_FILE => <config file>,
LOG_FILE_PATH => <path>,
);
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
$ua->agent("RTAT/$VERSION");
$ua->timeout(90); # in seconds
$ua->default_header('Accept' => '*/*'); # to get cross platform support
my ( $config, $total, $total_response_time, $skip, $pass, $fail ) = (0) x 6;
my ( $uri, $method, $req_content_type, $req_body, $status ) = (undef) x 5;
my ( $request, $response ) = (undef) x 2;
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
$pua->agent("RTAT/$VERSION");
$pua->in_order(1); # handle requests in order of registration
$pua->duplicates(0); # ignore duplicates
$pua->timeout(60); # in seconds
$pua->redirect(1); # follow redirects
$pua->default_header('Accept' => '*/*'); # to get cross platform support
my ( $config, $total, $total_response_time, $skip, $pass, $fail ) = (0) x 6;
my ( $uri, $method, $req_content_type, $req_body, $status ) = (undef) x 5;
my ( $request, $response ) = (undef) x 2;
my ( $username, $password ) = (undef) x 2;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing or non-interactive session, always use defaults
if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Arc/Connection/Server.pm view on Meta::CPAN
sub members
{
my $this = shift;
return { %{$this->SUPER::members},
_realm => "", # Name of the SASL realm, if the user is from the default realm, this is empty
logfileprefix => "server",
sasl_cb_getsecret => "", # Callback for SASL (if PLAIN (or equal) mechanisms are used). See Authen::SASL(::Cyrus).
sasl_cb_checkpass => 0, # Callback for SASL (if PLAIN (or equal) mechanisms are used). See Authen::SASL(::Cyrus).
sasl_mechanisms => undef, # array of allowed SASL mechanisms
lib/Arc/Connection/Server.pm view on Meta::CPAN
sub _CheckCmd
{
my $this = shift;
my ($cmd, $perlcmd) = @_;
# Do nothing by default.
# This method is mearly here so a sub-class can override it.
return undef;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARGV/Abs.pm view on Meta::CPAN
=head1 DESCRIPTION
This module transform all elements of C<@ARGV> into absolute pathnames.
Relative paths are resolved by default relative to the current directory.
To use another base directory, pass it as the argument for import.
=head1 SEE ALSO
Some other modules that add magic to C<@ARGV>: L<ARGV::URL>, L<ARGV::readonly>, L<Encode::Argv>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARGV/Struct.pm view on Meta::CPAN
our $VERSION = '0.06';
has argv => (
is => 'ro',
isa => ArrayRef,
default => sub { [ @ARGV ] },
);
sub argcount {
my $self = shift;
return scalar(@{ $self->argv });
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARGV/readonly.pm view on Meta::CPAN
the code is shorter than the documentation. Please look at it.
=head2 EXPORT
None by default.
=head1 TO DO
ideally a suite of ARGV::* modules will appear, each doing their little thing,
in a way that they won't stomp on each other's toes. This module has no
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARS/Simple.pm view on Meta::CPAN
=over 4
=item *
Provides obfuscated storage for default user and password so they are
not scattered throuhout all your scripts
=item *
Provide a perlish interface to ARSperl which makes your code
lib/ARS/Simple.pm view on Meta::CPAN
Set a limit on how many items may be returned from certain calls.
Setting this value to 0 sets unlimited returns. This parameter
can also be set on individual calls. B<Note:> This is a system wide
configuration change and requires administrator privilages on user.
B<Note: You should not use a value less than the default system value
for this field or you may impact normal operation of your system>
Example usage:
reset_limit => 0, # unlimited returns
lib/ARS/Simple.pm view on Meta::CPAN
# Get theEntry-Id's for all records in the 'User' form.
my $eids = $ars->get_list({ form => 'User', query => '1 = 1' });
The query parameter can be the same format as you would use in the 'User Tool'
to query a form, however we recommend the use of field ID's (FID) rather than the
default field name as they may change. I prefer to define a hash of the
forms lables and FID's so that can be used to better document your code, eg
my %user = ( UserID => 101, UserName => 102 );
the a query could be something like
lib/ARS/Simple.pm view on Meta::CPAN
see http://arsperl.sourceforge.net/manual/toc.html
=head1 Default User/Password
The default user and password to use can be configured during install
by the Config.PL script. This creates a configuration file Simple.cfg
which is stored with Simple.pm. Unless specified in the call to the
new method, the use and password from Simple.cfg will be used. This
has the advantage of a single place of change and removes the user and
password from scripts.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARSObject.pm view on Meta::CPAN
$r
}
sub vfload { # Load variables file
# (varname|-slot, ?{use default} | load default, ?renew | renew seconds) -> {data}
my($s,$f,$d,$nn) =@_; # -slot-calc, -slot-store
my $k =($f =~/^-/ ? $f : undef);
$f =$s->vfname($f);
if ($nn && $nn >1) {
my @st =stat($f);
lib/ARSObject.pm view on Meta::CPAN
$s;
}
sub sqlnesc { # SQL name escaping, default for '-sqlname', '-sqlntbl', '-sqlncol'
my $v =lc($_[1]); # (self, name) -> escaped
$v =~s/[^a-zA-Z0-9_]/_/g;
$v =substr($v,0,64) if length($v) >64;
$v
}
sub sqlninc { # SQL name incrementing, default for '-sqlninc'
my $v =$_[1]; # (self, name) -> incremented
my ($n, $nn);
if (0) {
($n, $nn) =$v =~/^(.+?)_([1-9]+)$/ ? ($1, '_' .($2 +1)) : ($v, '_1');
}
lib/ARSObject.pm view on Meta::CPAN
.')';
foreach my $k (%{$s->{-meta}->{$f}->{-fields}}) {
my $ff =$s->{-meta}->{$f}->{-fields}->{$k};
next if !$ff
|| exists($a{$k})
|| ((!defined($ff->{defaultVal}) || ref($ff->{defaultVal}))
&& !$s->{-metaid}->{$ff->{fieldId}}->{defaultVal});
$a{$k} =defined($s->{-metaid}->{$ff->{fieldId}}->{defaultVal})
? $s->{-metaid}->{$ff->{fieldId}}->{defaultVal}
: $ff->{defaultVal};
$a{$k} =$s->{-metaid}->{$ff->{fieldId}}->{strOut}
? &{$s->{-metaid}->{$ff->{fieldId}}->{strOut}}($s,$f,$s->{-metaid}->{$ff->{fieldId}},$_=$a{$k})
: strOut($s, $f, $ff->{fieldId},$_=$a{$k})
if $s->{-strFields};
}
lib/ARSObject.pm view on Meta::CPAN
@r
}
sub dbidsqq { # DBI datastore - quote/parse condition to SQL names
my ($s,$sf,$mh) =@_; # (self, query string, default sql metadata)
if (0) {
my $q =substr($s->{-dbi}->quote_identifier(' '),0,1);
$sf =~s/$q([^$q]+)$q\.$q([^$q]+)$q/!$s->{'-meta-sql'}->{-forms}->{$1} ? "?1$q$1${q}.$q$2$q" : $s->{'-meta-sql'}->{$s->{'-meta-sql'}->{-forms}->{$1}}->{-fields}->{$2} ? $s->{-dbi}->quote_identifier($s->{'-meta-sql'}->{-forms}->{$1}) .'.' .$s->{-dbi}-...
$sf =~s/$q([^$q]+)$q/$s->{'-meta-sql'}->{-forms}->{$1} ? ($s->{-sqlschema} ? $s->{-dbi}->quote_identifier($s->{-sqlschema}) .'.' : '') .$s->{-dbi}->quote_identifier($s->{'-meta-sql'}->{-forms}->{$1}) : $mh->{-fields}->{$1} ? $s->{-dbi}->quote_identi...
return($sf);
lib/ARSObject.pm view on Meta::CPAN
}
sub cgitext { # CGI textarea field
$_[0]->{-cgi}->textarea(@_[1..$#_])
# -default=>$v, -override=>1
}
sub cgistring { # CGI string field
$_[0]->{-cgi}->textfield(@_[1..$#_])
lib/ARSObject.pm view on Meta::CPAN
};
my $ac=$a{-class} ? ' class="' .$a{-class} .'"' : '';
my $as=$a{-style} ? ' style="' .$a{-style} .'"' : '';
my $aw=$a{-size} ||80;
my $v =!defined($s->{-cgi}->param($n)) ||$a{-override}
? $a{-default}
: $s->{-cgi}->param($n);
$v =&$av()->[0]
if $a{-strict} && (!defined($v) || !grep /^\Q$v\E$/, @{&$av()});
$s->{-cgi}->param($n, defined($v) ? $v : '');
my $ek =$s->{-cgi}->user_agent('MSIE') ? 'window.event.keyCode' : 'event.which';
lib/ARSObject.pm view on Meta::CPAN
? ($_ => $a{$_})
: $a{-textfield} && $a{-textfield}->{$_} && !$s->{-cgi}->param("${n}__O_")
? ($_ => $a{-textfield}->{$_})
: ()
} qw(-name -title -class -style -size -maxlength))
, -default=>$v
, -override=>1
, ($a{-strict} && !$s->{-cgi}->param("${n}__O_")
? (-readonly=>1) # ,-hidefocus=>0, -disabled=>0
: ())
)
lib/ARSObject.pm view on Meta::CPAN
if !($f->{-values} ||$f->{-labels})
&& schvals($s, $f->{-formdb}, $fm);
$f->{-labels} =schlblsl($s, $f->{-formdb}, $fm)
if !$f->{-labels}
&& schlbls($s, $f->{-formdb}, $fm);
$f->{-value} =$fm->{defaultVal}
if !exists($f->{-value})
&& exists($fm->{defaultVal});
}
if (!$f->{-namecgi}) {
$f->{-namecgi} =$f->{-name};
$f->{-namecgi} =~s/[\s-]/_/g
if $f->{-namecgi};
lib/ARSObject.pm view on Meta::CPAN
&{$f->{-values}}($_[0], $f, $_)})
: $f->{-values}
}
sub cfpvv { # Field Player: field value or default
# (self, field || fieldname) -> value
my $v =cfpv(@_);
defined($v) ? $v : cfpvd(@_)
}
sub cfpvd { # Field Player: field default value
# (self, field || fieldname) -> value
my $f =ref($_[1])
? $_[1]
: ($_[0]->{-fphc}->{$_[1]} ||$_[0]->{-fphd}->{$_[1]});
!$f
view all matches for this distribution
view release on metacpan or search on metacpan
my($field);
# entry id field is field id #1
($field = ars_GetField($c, $schema, 1)) ||
return undef;
if( $field->{defaultVal} ){
return $field->{defaultVal}.("0"x($field->{limit}{maxLength}-length($field->{defaultVal})-length($entry_id))).$entry_id;
}else{
return ("0"x($field->{limit}{maxLength}-length($entry_id))).$entry_id;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
applications/archive.pl view on Meta::CPAN
my $prgtext = "Archiver for the '$APPLICATION'";
my $version = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; # must be all on one line or MakeMaker will get confused.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $doCgisess = 1; # default
my $doReports = 1; # default
my $doDatabase = 0; # default
my $doYearsAgo = -1; # default
my $doForce = 0; # default
my $debug = 0; # default
#------------------------------------------------------------------------
# Don't edit below here unless you know what you are doing. -------------
#------------------------------------------------------------------------
applications/archive.pl view on Meta::CPAN
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Archiver for the '$APPLICATION'
-A, --archivelist=<filename>
FILENAME : filename from the archivelist for the html output loop (default undef)
-c, --cgisess=F|T
F(alse) : don't remove the cgisess files
T(true) : remove the cgisess files (default)
-r, --reports=F|T
F(alse) : don't backup Csv, Sql, Error, Week, Debug reports
T(true) : remove backup Csv, Sql, Error, Week, Debug reports (default)
-d, --database=F|T
F(alse) : don't archive the '$SERVERTABLEVENTS' and '$SERVERTABLCOMMENTS' tables (default)
T(true) : archive the '$SERVERTABLEVENTS' and '$SERVERTABLCOMMENTS' tables
-y, --yearsago=<years ago>
YEARS AGO: c => current year or 1..9 => the number of years ago that the '$SERVERTABLEVENTS'
and '$SERVERTABLCOMMENTS' tables need to be created
-f, --force=F|T
F(alse) : don't force CSV import (default)
T(true) : force CSV import
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
view all matches for this distribution
view release on metacpan or search on metacpan
=cut
sub Warn { ASP::Print(@_); }
=head2 print LIST
C<print> is overloaded to write to the browser by default. The inherent
behavior of print has not been altered and you can still use an alternate
filehandle as you normally would. This allows you to use print just
as you would in CGI scripts. The following statement would need no
modification between CGI and ASP PerlScript:
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
http://aubbc.googlecode.com/
Development Notes: Highlighting functions list and tags/commands for more
language highlighters. Ideas make some new tags like [perl] or have a command in the code
tag like [code]perl:print 'perl';[/code] with a default highlighting method if
a command was not used. Then highlighting of many types of code could be allowed
even markup like HTML.
Notes: This code has a lot of settings and works good
with most default settings see the POD and example files
in the archive for usage.
=head1 NAME
AUBBC
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AVLTree.pm view on Meta::CPAN
by the provided callback.
Returntype : AVLTreePtr or undef if unable to instantiate
Exceptions : None
Caller : General
Status : Unstable, interface might change to accomodate suitable defaults,
e.g. numbers
=head2 C<find>
Arg [1] : Item to search, can be defined just in terms of the attribute
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/ARN.pm view on Meta::CPAN
is => 'rw',
isa => $ArnPartition,
lazy => 1,
builder => '_build_partition',
clearer => '_clear_partition',
default => 'aws',
trigger => sub { shift->_clear_arn },
);
has service => (
is => 'rw',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/CLI/Config.pm view on Meta::CPAN
use File::Spec;
use autodie;
our $VERSION = '0.05';
my $DEFAULT_PROFILE = 'default';
my $CREDENTIALS;
my %CREDENTIALS_PROFILE_OF;
my $CONFIG;
my %CONFIG_PROFILE_OF;
lib/AWS/CLI/Config.pm view on Meta::CPAN
return sub {
if ($env_var && exists $ENV{$env_var} && $ENV{$env_var}) {
return $ENV{$env_var};
}
my $profile = shift || _default_profile();
my $credentials = credentials($profile);
if ($credentials && $credentials->$profile_key) {
return $credentials->$profile_key;
}
lib/AWS/CLI/Config.pm view on Meta::CPAN
return undef;
};
}
sub credentials {
my $profile = shift || _default_profile();
$CREDENTIALS ||= _parse(
(exists $ENV{AWS_CONFIG_FILE} and $ENV{AWS_CONFIG_FILE})
? $ENV{AWS_CONFIG_FILE}
: File::Spec->catfile(_default_dir(), 'credentials')
);
return unless (exists $CREDENTIALS->{$profile});
$CREDENTIALS_PROFILE_OF{$profile} ||=
AWS::CLI::Config::Profile->new($CREDENTIALS->{$profile});
return $CREDENTIALS_PROFILE_OF{$profile};
}
sub config {
my $profile = shift || _default_profile();
$CONFIG ||= _parse(
(exists $ENV{AWS_CONFIG_FILE} and $ENV{AWS_CONFIG_FILE})
? $ENV{AWS_CONFIG_FILE}
: File::Spec->catfile(_default_dir(), 'config')
);
return unless (exists $CONFIG->{$profile});
$CONFIG_PROFILE_OF{$profile} ||=
AWS::CLI::Config::Profile->new($CONFIG->{$profile});
lib/AWS/CLI/Config.pm view on Meta::CPAN
sub _base_dir {
($^O eq 'MSWin32') ? $ENV{USERPROFILE} : $ENV{HOME};
}
sub _default_dir {
File::Spec->catdir(_base_dir(), '.aws');
}
sub _default_profile {
(exists $ENV{AWS_DEFAULT_PROFILE} && $ENV{AWS_DEFAULT_PROFILE})
? $ENV{AWS_DEFAULT_PROFILE}
: $DEFAULT_PROFILE;
}
# This only supports one level of nesting, but it seems AWS config files
# themselves only have but one level
sub _parse {
my $file = shift;
my $profile = shift || _default_profile();
my $hash = {};
my $nested = {};
return +{} unless -r $file;
lib/AWS/CLI/Config.pm view on Meta::CPAN
specify the profile as the first argument.
=head2 config (Str)
Fetches information from the config file if it exists. If you need to override
the default path of this file, use the C<$ENV{AWS_CONFIG_FILE}> variable.
You can optionally specify the profile as the first argument.
=head2 Automatic accessors
Accessors will also be automatically generated for all top-level keys in a given
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/CLIWrapper.pm view on Meta::CPAN
my $res = $aws->ec2(
'describe-instances' => {
instance_ids => ['i-XXXXX', 'i-YYYYY'],
},
timeout => 18, # optional. default is 30 seconds
);
if ($res) {
for my $rs ( @{ $res->{Reservations} }) {
for my $is (@{ $rs->{Instances} }) {
lib/AWS/CLIWrapper.pm view on Meta::CPAN
Third arg "opt" is optional. Available key/values are below:
timeout => Int
Maximum time the "aws" command is allowed to run before aborting.
default is 30 seconds, unless overridden with AWS_CLIWRAPPER_TIMEOUT environment variable.
nofork => Int (>0)
Call IPC::Cmd::run vs. IPC::Cmd::run_forked (mostly useful if/when in perl debugger). Note: 'timeout', if used with 'nofork', will merely cause an alarm and return. ie. 'run' will NOT kill the awscli command like 'run_forked' will.
croak_on_error => Int (>0)
lib/AWS/CLIWrapper.pm view on Meta::CPAN
was caught with catch_error_pattern, before giving up. Environment variable
AWS_CLIWRAPPER_CATCH_ERROR_RETRIES takes precedence over this option, if both
are defined.
0 (zero) retries is a valid way to turn off error catching via environment variable
in certain scenarios. Negative values are invalid and will be reset to default.
Default is 3.
catch_error_min_delay => Int (>= 0)
When defined, this option will set the minimum delay in seconds before attempting
a retry of failed `aws-cli` execution when the error was caught. Environment variable
AWS_CLIWRAPPER_CATCH_ERROR_MIN_DELAY takes precedence over this option, if both
are defined.
0 (zero) is a valid value. Negative values are invalid and will be reset to default.
Default is 3.
catch_error_max_delay => Int (>= 0)
When defined, this option will set the maximum delay in seconds before attempting
a retry of failed `aws-cli` execution. Environment variable AWS_CLIWRAPPER_CATCH_ERROR_MAX_DELAY
takes precedence over this option, if both are defined.
0 (zero) is a valid value. Negative values are invalid and will be reset to default.
If catch_error_min_delay is greater than catch_error_max_delay, both are set
to catch_error_min_delay value.
Default is 10.
lib/AWS/CLIWrapper.pm view on Meta::CPAN
=head1 ENVIRONMENT
=over 4
=item HOME: used by default by /usr/bin/aws utility to find it's credentials (if none are specified)
Special note: cron on Linux will often have a different HOME "/" instead of "/root" - set $ENV{'HOME'}
to use the default credentials or specify $ENV{'AWS_CONFIG_FILE'} directly.
=item AWS_CLIWRAPPER_TIMEOUT
If this variable is set, this value will be used instead of default timeout (30 seconds) for every
invocation of `aws-cli` that does not have a timeout value provided in the options argument of the
called function.
=item AWS_CLIWRAPPER_CATCH_ERROR_PATTERN
lib/AWS/CLIWrapper.pm view on Meta::CPAN
=head1 ERROR HANDLING
=over 4
By default, when `aws-cli` exits with an error code (> 0), AWS::CLIWrapper will set
the error code and message to $AWS::CLIWrapper::Error (and optionally croak), thus
relaying the error to calling code. While this approach is beneficial 99% of the time,
in some use cases `aws-cli` execution fails for a temporary reason unrelated to
both calling code and AWS::CLIWrapper, and can be safely retried after a short delay.
lib/AWS/CLIWrapper.pm view on Meta::CPAN
The error catching pattern, as well as other configuration, can be defined either
as AWS::CLIWrapper options in the code, or as respective environment variables
(see L<ENVIRONMENT>).
The actual delay before retrying a failed `aws-cli` execution is computed as a
random value of seconds between catch_error_min_delay (default 3) and catch_error_max_delay
(default 10). Backoff is not supported at this moment.
=back
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/IP.pm view on Meta::CPAN
}
bless {
cache => Cache::File->new( cache_root => ($cache_path || tempdir()),
lock_level => Cache::File::LOCK_LOCAL(),
default_expires => "$cache_timeout_secs sec"),
}, $class;
}
=head2 ip_is_aws ($ip, [$service])
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/Lambda/Quick.pm view on Meta::CPAN
going on when the script uploads itself. This is subject to change
in later versions of this utility as better ways to do things
become available (for example AWS has a HTTP API that is currently in
beta that could make some of this easier!).
By default, unless you specify extra parameters when you import
AWS::Lambda::Quick, AWS will be configured as described below
=head3 Create A New Role For Use With AWS::Lambda::Quick
Execution creates a new role called C<perl-aws-lambda-quick> that can
lib/AWS/Lambda/Quick.pm view on Meta::CPAN
=head3 Deploying the Code.
Once all the above is done the module finally deploys the code
so it's web accessible.
By default this is to the C<quick>, though you can reconfigure that
with the C<stage_name> parameter.
=head2 Parameters
This is a full list of parameters you can currently configure. Only
one parameter - C<name> - is required and all other parameters are
optional and will have hopefully sensible defaults.
It is not the intent of the author to provide a complete and exhaustive
list of all possibilities - you have the power of the AWS Management
console and AWS API to make any further tweaks you may desire.
lib/AWS/Lambda/Quick.pm view on Meta::CPAN
file/directory is not present at the passed location it will be
silently ignored.
=item region
The region you wish to deploy the lamda function to. By default
this will be C<us-east-1>.
=item memory_size
The amount of memory that your function has access to. Increasing
the function's memory also increases its CPU allocation. The default
value is 128 MB. The value must be a multiple of 64 MB.
=item timeout
The amount of time that Lambda allows a function to run before stopping
it. The default is 3 seconds. The maximum allowed value is 900 seconds.
=item role
The AWS role you want to run the Lambda function as. This can
either be a full arn, or the name of the role to use (which will
lib/AWS/Lambda/Quick.pm view on Meta::CPAN
accounts, but will reduce the number of API calls made during updates.
=item rest_api
The name of the rest api to use if you did not pass a C<rest_api_id>
(if you did this parameter will be ignored.) Will default to
C<perl-aws-lambda-quick> if not passed. If no such named rest api
exists then one will be automatically created.
=item stage_name
The name we stage to. By default this is C<quick> meaning that
our live URL will be of the form:
https://????.execute-api.????.amazonaws.com/quick/????
By setting stage_name to another value you can change this.
lib/AWS/Lambda/Quick.pm view on Meta::CPAN
Default region name [us-east-1]:
Default output format [None]:
=head2 Speeding up Code Updates
By default this module will check that everything is configured
correctly in AWS and will make changes as needed. This requires several
API calls (and several executions of the AWS python command line
tool.)
If you've only changed the source code and want to deploy a new version
view all matches for this distribution
view release on metacpan or search on metacpan
author/update-aws-lambda-al.pl view on Meta::CPAN
use AWS::Lambda::AL;
my $info = AWS::Lambda::AL::get_layer_info(
"@@LATEST_PERL@@", # Perl Version
"us-east-1", # Region
"x86_64", # Architecture ("x86_64" or "arm64", optional, the default is "x86_64")
);
say $info->{runtime_arn}; # @@LATEST_RUNTIME_ARN@@
say $info->{runtime_version}; # @@LATEST_RUNTIME_VERSION@@
say $info->{paws_arn} # @@LATEST_PAWS_ARN@@
say $info->{paws_version} # @@LATEST_PAWS_VERSION@@,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/Networks.pm view on Meta::CPAN
our $VERSION = '0.01';
has url => (
is => 'ro',
isa => 'Str|Undef',
default => 'https://ip-ranges.amazonaws.com/ip-ranges.json'
);
has netinfo => (
is => 'ro',
isa => 'HashRef',
default => sub {
my $self = shift;
die "Can't get some properties from derived results" if (not $self->url);
my $response = HTTP::Tiny->new->get($self->url);
die "Error downloading URL" unless ($response->{ success });
return decode_json($response->{ content });
lib/AWS/Networks.pm view on Meta::CPAN
);
has sync_token => (
is => 'ro',
isa => 'DateTime',
default => sub {
return DateTime->from_epoch( epoch => shift->netinfo->{ syncToken } );
},
lazy => 1,
);
has networks => (
is => 'ro',
isa => 'ArrayRef',
default => sub {
return shift->netinfo->{ prefixes };
},
lazy => 1,
);
has regions => (
is => 'ro',
isa => 'ArrayRef',
default => sub {
my ($self) = @_;
my $regions = {};
map { $regions->{ $_->{ region } } = 1 } @{ $self->networks };
return [ keys %$regions ];
},
lib/AWS/Networks.pm view on Meta::CPAN
}
has services => (
is => 'ro',
isa => 'ArrayRef',
default => sub {
my ($self) = @_;
my $services = {};
map { $services->{ $_->{ service } } = 1 } @{ $self->networks };
return [ keys %$services ];
},
lib/AWS/Networks.pm view on Meta::CPAN
}
has cidrs => (
is => 'ro',
isa => 'ArrayRef',
default => sub {
my ($self) = @_;
return [ map { $_->{ ip_prefix } } @{ $self->networks } ];
},
lazy => 1,
);
view all matches for this distribution