view release on metacpan or search on metacpan
0.10 2004-06-29
- If an Alzabo::Exception::RDBMSRules exception is thrown, the full
exception (with stack trace) is now output to STDERR. This helps
debugging in case the exception is due to an error in Alzabo, as
opposed to user error.
- Some submission handling components were redirecting to the wrong
place after handling a RDBMSRules exception.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/API.pm view on Meta::CPAN
__PACKAGE__->follow_best_practice;
__PACKAGE__->mk_accessors(qw/action api api_methods version content_type
http_method credentials response protocol
region url service_url_base
signer target user_agent debug last_action
aws_access_key_id aws_secret_access_key token
/);
use vars qw/@EXPORT $VERSION/;
lib/Amazon/API.pm view on Meta::CPAN
=item url
The service url. Example: https://events.us-east-1.amazonaws.com
=item debug
0/1 - will dump request/response if set to true.
=item action
lib/Amazon/API.pm view on Meta::CPAN
$content = $parameters;
}
my $rsp = $self->submit(content => $content, content_type => $content_type);
if ( $self->get_debug ) {
print STDERR Dumper [$rsp];
}
# probably want to decode content when there is an error, but this
# will do for now
lib/Amazon/API.pm view on Meta::CPAN
# sign the request
$self->get_signer->sign($request);
# make the request, return response object
if ( $self->get_debug ) {
print STDERR Dumper([$request]);
}
$self->get_user_agent->request($request);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/Credentials.pm view on Meta::CPAN
use parent qw/Class::Accessor Exporter/;
__PACKAGE__->follow_best_practice;
__PACKAGE__->mk_accessors(qw/aws_secret_access_key aws_access_key_id token region
user_agent profile debug expiration role container order
serialized logger
/);
use Data::Dumper;
use Date::Format;
lib/Amazon/Credentials.pm view on Meta::CPAN
$VERSION = '1.0.10-1'; $VERSION=~s/\-.*$//;
@EXPORT = qw/$VERSION/;
# we only log at debug level, create a default logger
{
no strict 'refs';
*{'Amazon::Credentials::Logger::debug'} = sub {
shift;
my @tm = localtime(time);
print STDERR sprintf("%s [%s] %s", strftime("%c", @tm), $$, @_);
};
}
lib/Amazon/Credentials.pm view on Meta::CPAN
=head2 new
new( options );
my $aws_creds = new Amazon::Credential( { profile => 'sandbox', debug => 1 });
C<options> is a hash of keys that represent options. Any of the
options can also be retrieved using their corresponding 'get_{option}
method.
lib/Amazon/Credentials.pm view on Meta::CPAN
AWS secret access key.
I<Note: If you pass the access keys in the constructor then the
constructor will not look in other places for credentials.>
=item debug
Set to true for verbose troubleshooting information.
=item logger
Pass in your own logger that has a C<debug()> method. Otherwise the
default logger will output debug messages to STDERR.
=item user_agent
Pass in your own user agent, otherwise LWP will be used. I<Probably
only useful to override this for testing purposes.>
lib/Amazon/Credentials.pm view on Meta::CPAN
}
}
close $fh;
$self->get_logger->debug(Dumper [ $creds ])
if $self->get_debug;
$creds->{source} = $config if $creds->{aws_secret_access_key} && $creds->{aws_access_key_id};
}
last if $creds->{source};
lib/Amazon/Credentials.pm view on Meta::CPAN
$g -= $window_interval * 60;
# (expiration_time - window_interval) - current_time = # of seconds left before expiration
my $seconds_left = $g - time;
if ( $self->get_debug ) {
my $hours = int($seconds_left/3600);
my $minutes = int(($seconds_left - $hours * 3600)/60);
my $seconds = $seconds_left - ($hours * 3600 + $minutes * 60);
$self->get_logger->debug(sprintf("%d hours %d minutes %d seconds until expiry\n", $hours, $minutes, $seconds));
}
$expired = ($seconds_left < 0) ? 1 : 0;
$self->get_logger->debug(Dumper [ "EXPIRATION TIME: " . $expiration_date, "EXPIRED: " . $expired])
if $self->get_debug;
}
return $expired;
}
lib/Amazon/Credentials.pm view on Meta::CPAN
$url .= $role if $role;
my $req = HTTP::Request->new( GET => $url );
$self->get_logger->debug(Dumper [ "HTTP REQUEST:\n", $req ])
if $self->get_debug;
my $rsp = $ua->request($req);
$self->get_logger->debug(Dumper [ "HTTP RESPONSE:\n", $rsp ])
if $self->get_debug;
# if not 200, then get out of Dodge
last unless $rsp->is_success;
if ( $role ) {
lib/Amazon/Credentials.pm view on Meta::CPAN
@{$creds}{qw/source role aws_access_key_id aws_secret_access_key token expiration/} =
('IAM',$role, @{$this}{qw/AccessKeyId SecretAccessKey Token Expiration/});
}
else {
$role = $rsp->content;
$self->get_logger->debug(Dumper ['role', $role])
if $self->get_debug;
last unless $role;
}
}
};
lib/Amazon/Credentials.pm view on Meta::CPAN
}
elsif ( $self->get_role ) {
$creds = $self->get_creds_from_role;
}
$self->get_logger->debug(Dumper [$creds])
if $self->get_debug;
die "unable to refresh token!"
unless ref($creds);
$self->set_credentials($creds);
lib/Amazon/Credentials.pm view on Meta::CPAN
my $ua = $self->get_user_agent;
my $req = HTTP::Request->new( GET => $url );
$req->header("Accept", "*/*");
$self->get_logger->debug(Dumper [ "HTTP REQUEST:\n", $req ])
if $self->get_debug;
$self->get_logger->debug(Dumper [ $req->as_string ])
if $self->get_debug;
my $rsp = $ua->request($req);
$self->get_logger->debug(Dumper [ "HTTP RESPONSE:\n", $rsp ])
if $self->get_debug;
# if not 200, then get out of Dodge
if ( $rsp->is_success ) {
$creds->{serialized} = $rsp->content;
my $this = from_json($rsp->content);
@{$creds}{qw/source container aws_access_key_id aws_secret_access_key token expiration/} =
('IAM','ECS', @{$this}{qw/AccessKeyId SecretAccessKey Token Expiration/});
}
else {
$self->get_logger->debug( "return code: " . $rsp->status_line . "\n");
}
$creds->{error} = $@ if $@;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/Dash/Button/Device.pm view on Meta::CPAN
die "mac address is undefined" unless defined $self->mac();
return $self;
}
sub debug {
warn join( ' ', map { $_ // 'undef' } @_ );
}
sub check {
my ( $self, $mac2check ) = @_;
lib/Amazon/Dash/Button/Device.pm view on Meta::CPAN
$mac2check =~ s{:}{}g;
return if $self->mac() ne lc($mac2check);
debug( "Find Button", $self->name() );
my $now = time();
return
if $self->timeout > 0 && ( $now - $self->last_click ) <= $self->timeout;
$self->last_click($now);
debug( "perform onClick for", $self->name() );
# we want to fork to run the onClick action
# we can disable it during unit tests or others
return
if $self->_fork_for_onClick()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/DynamoDB.pm view on Meta::CPAN
use_iam_role => 1,
host => 'dynamodb.us-east-1.amazonaws.com',
scope => 'us-east-1/dynamodb/aws4_request',
ssl => 1,
debug => 1);
$ddb->batch_get_item(
sub {
my $tbl = shift;
my $data = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/MWS/Routines.pm view on Meta::CPAN
$content = $response->content;
}
if ($self->{debug}) {
open LOG, ">>$self->{logfile}";
print LOG Dumper($response);
}
my $xs = XML::Simple->new( KeepRoot => 1 );
lib/Amazon/MWS/Routines.pm view on Meta::CPAN
$opts{access_key_id} ||= $xmlconfig->{access_key_id};
$opts{secret_key} ||= $xmlconfig->{secret_key};
$opts{merchant_id} ||= $xmlconfig->{merchant_id};
$opts{marketplace_id} ||= $xmlconfig->{marketplace_id};
$opts{endpoint} ||= $xmlconfig->{endpoint};
$opts{debug} ||= $xmlconfig->{debug};
$opts{logfile} ||= $xmlconfig->{logfile};
}
my $attr = $opts->{agent_attributes};
$attr->{Language} = 'Perl';
lib/Amazon/MWS/Routines.pm view on Meta::CPAN
die 'No access key id' unless $opts{access_key_id};
die 'No secret key' unless $opts{secret_key};
die 'No merchant id' unless $opts{merchant_id};
die 'No marketplace id' unless $opts{marketplace_id};
if ($opts{debug}) {
open LOG, ">$opts{logfile}" or die "Cannot open logfile.";
print LOG DateTime->now();
print LOG "\nNew instance created. \n";
print LOG Dumper(\%opts);
close LOG;
lib/Amazon/MWS/Routines.pm view on Meta::CPAN
endpoint => $opts{endpoint},
access_key_id => $opts{access_key_id},
secret_key => $opts{secret_key},
merchant_id => $opts{merchant_id},
marketplace_id => $opts{marketplace_id},
debug => $opts{debug},
logfile => $opts{logfile},
}, $pkg;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Lite.pm view on Meta::CPAN
my $logger = $self->{logger};
if ( $logger && blessed $logger ) {
# Validate it quacks like a logger
for my $method (qw(trace debug info warn error)) {
croak "logger object must implement '$method'"
if !$logger->can($method);
}
return;
lib/Amazon/S3/Lite.pm view on Meta::CPAN
);
# HTTP::Tiny sets Host itself â remove to avoid duplicate header error
delete $signed->{host};
$self->logger->debug("$method $url");
my $options = { headers => $signed };
if ( length $content || $content_is_coderef ) {
$options->{content} = $content;
lib/Amazon/S3/Lite.pm view on Meta::CPAN
$options->{data_callback} = $extra->{data_callback};
}
my $response = $self->ua->request( $method, $url, $options );
$self->logger->debug( sprintf 'Response: %s %s', $response->{status}, $response->{reason} );
$self->{last_status} = $response->{status};
return $response;
}
lib/Amazon/S3/Lite.pm view on Meta::CPAN
$self->_croak_on_error( $response, 'get_bucket_notification_configuration' );
my $rsp = $self->_parse_notification_configuration( $response->{content} );
$self->logger->debug(
Dumper(
[ response => $response,
parsed_response => $rsp
]
)
lib/Amazon/S3/Lite.pm view on Meta::CPAN
queue_arn => $options{queue_arn},
events => "@event_xml",
filters => $filters,
);
$self->logger->debug( Dumper( [ resolved_xml => $resolved_xml ] ) );
return $resolved_xml;
}
########################################################################
lib/Amazon/S3/Lite.pm view on Meta::CPAN
my $templates = $self->_fetch_templates();
my $xml = $self->_resolve( $templates->{'public_access_block'}, %permissions );
$xml = qq{<?xml version="1.0" encoding="UTF-8"?>\n} . $xml;
$self->logger->debug( Dumper( [ xml => $xml ] ) );
return $xml;
}
########################################################################
lib/Amazon/S3/Lite.pm view on Meta::CPAN
=item logger
An object providing the standard log methods:
$logger->trace(...)
$logger->debug(...)
$logger->info(...)
$logger->warn(...)
$logger->error(...)
If not supplied, the module looks for L<Log::Log4perl>. If available,
lib/Amazon/S3/Lite.pm view on Meta::CPAN
=over 4
=item log_level
Log level for the internal logger. Accepted values: C<trace>, C<debug>,
C<info>, C<warn>, C<error>, C<fatal>. Default is C<warn>. Only consulted
when no C<logger> object is supplied and Log::Log4perl is not available
or not yet initialized.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3/Thin.pm view on Meta::CPAN
bless $self, $class;
$self->secure(0) unless defined $self->secure;
$self->ua($self->_default_ua) unless defined $self->ua;
$self->debug(0) unless defined $self->debug;
$self->virtual_host(0) unless defined $self->virtual_host;
$self->{signature_version} = 4 unless defined $self->{signature_version};
if ($self->{signature_version} == 4 && ! $self->{region}) {
croak "Please set region when you use signature v4";
lib/Amazon/S3/Thin.pm view on Meta::CPAN
} else {
return $self->{secure};
}
}
sub debug {
my $self = shift;
if (@_) {
$self->{debug} = shift;
} else {
return $self->{debug};
}
}
sub ua {
my $self = shift;
lib/Amazon/S3/Thin.pm view on Meta::CPAN
}
}
sub _send {
my ($self, $request) = @_;
warn "[Request]\n" , $request->as_string if $self->{debug};
my $response = $self->ua->request($request);
warn "[Response]\n" , $response->as_string if $self->{debug};
return $response;
}
# API calls
lib/Amazon/S3/Thin.pm view on Meta::CPAN
Default is an instance of L<LWP::UserAgent>.
=item * C<signature_version> - AWS signature version to use. Supported values
are 2 and 4. Default is 4.
=item * C<debug> - debug option. Default is 0 (false).
If set 1, contents of HTTP request and response are shown on stderr
=item * C<virtual_host> - whether to use virtual-hosted style request format. Default is 0 (path-style).
=back
lib/Amazon/S3/Thin.pm view on Meta::CPAN
The user agent used internally to perform requests and return responses.
If you set this attribute, please make sure you do so with an object
compatible with L<LWP::UserAgent> (i.e. providing the same interface).
=head2 debug
Debug option.
=head1 Operations on Buckets
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3.pm view on Meta::CPAN
if none { $options{checksum_algorithm} eq $_ } @AWS_CHECKSUM_TYPES;
$options{_region} = delete $options{region};
$options{_signer} = delete $options{signer};
# convenience for level => 'debug' & for consistency with
# Amazon::Credentials only do this if we are using internal logger,
# call should NOT use debug flag but rather use their own logger's
# level to turn on higher levels of logging...
if ( !$options{logger} ) {
if ( delete $options{debug} ) {
$options{level} = 'debug';
}
$options{log_level} = delete $options{level};
$options{log_level} //= $DEFAULT_LOG_LEVEL;
lib/Amazon/S3.pm view on Meta::CPAN
my $self = $class->SUPER::new( \%options );
# setup logger internal logging
$self->get_logger->debug(
sub {
my %safe_options = %options;
if ( $safe_options{aws_secret_access_key} ) {
$safe_options{aws_secret_access_key} = '****';
lib/Amazon/S3.pm view on Meta::CPAN
if (@args) {
$self->_region( $args[0] );
}
$self->get_logger->debug( sub { return 'region: ' . ( $self->_region // $EMPTY ) } );
if ( $self->_region ) {
my $host = $self->host;
$self->get_logger->debug( sub { return 'host: ' . $self->host } );
# only add region if host was not populated from endpoint_url
if ( !$self->endpoint_url && $host =~ /\As3[.](.*)?amazonaws/xsm ) {
$self->host( sprintf 's3.%s.amazonaws.com', $self->_region );
}
lib/Amazon/S3.pm view on Meta::CPAN
keys %{$conf};
$path .= $query_string;
}
$self->get_logger->debug( sprintf 'PATH: %s', $path );
my $r = $self->send_request(
{ method => 'GET',
path => $path,
headers => $headers // {}, # { 'Content-Length' => 0 },
lib/Amazon/S3.pm view on Meta::CPAN
);
return
if !$r || $self->errstr;
$self->get_logger->debug(
sub {
return Dumper(
[ marker => $marker,
next_marker => $next_marker,
response => $r,
lib/Amazon/S3.pm view on Meta::CPAN
my $bucket = $1;
$path = $2;
my $query_string = $3;
$self->logger->debug(
sub {
return Dumper(
[ bucket => $bucket,
path => $path,
query_string => $query_string,
lib/Amazon/S3.pm view on Meta::CPAN
my $response = $self->_do_http($request);
$self->last_response($response);
$logger->debug(
sub {
return Dumper( [ response => $response ] );
}
);
lib/Amazon/S3.pm view on Meta::CPAN
# to try again with the new URL
my $location = $response->header('Location');
if ( $response->code =~ /\A3/xsm and defined $location ) {
$self->get_logger->debug(
sub {
return { sprintf 'Redirecting to: %s', $location };
}
);
$request->uri($location);
$response = $self->ua->request( $request, $filename );
}
$self->get_logger->debug( sub { return Dumper( [$response] ) } );
$self->last_response($response);
return $response;
}
lib/Amazon/S3.pm view on Meta::CPAN
# convenient time to reset any error conditions
$self->reset_errors;
my $response = $self->ua->request( $request, $filename );
$self->get_logger->debug( sub { return Dumper( [$response] ) } );
$self->last_response($response);
return $response;
}
lib/Amazon/S3.pm view on Meta::CPAN
}
else {
$self->_handle_response_error( $response, $TRUE );
}
$self->get_logger->debug(
sub {
return sprintf 'setting override URI: [%s]', $override_uri;
}
);
}
lib/Amazon/S3.pm view on Meta::CPAN
L<Amazon::Credentials> is one implementation of this interface.
See L</AUTHENTICATION AND CREDENTIALS>.
=item debug
Compatibility option that sets the default logger level to C<debug>.
Applications should normally use C<level> instead.
This option affects the internally created logger only.
lib/Amazon/S3.pm view on Meta::CPAN
=head3 level
my $level = $s3->level;
$s3->level('debug');
Gets or sets the logging level.
When a level is supplied, both the stored logging level and the
associated logger level are updated.
lib/Amazon/S3.pm view on Meta::CPAN
fatal
error
warn
info
debug
trace
The default level is C<error>.
At C<debug> level, C<Amazon::S3> records higher-level request and
configuration information.
At C<trace> level, HTTP request and response information may also be
logged.
lib/Amazon/S3.pm view on Meta::CPAN
When reporting a problem, include the C<Amazon::S3> version, Perl
version, operating system, and enough information to reproduce the
behavior.
For request or protocol problems, debug or trace logging may also be
useful. Review logs before sharing them to ensure that they do not
contain credentials, authorization information, or sensitive object
data.
=head1 REPOSITORY
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/S3Curl/PurePerl.pm view on Meta::CPAN
set_logger(
Log::Contextual::SimpleLogger->new(
{
levels_upto => 'debug'
} ) );
has curl => (
is => 'ro',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SNS/V4.pm view on Meta::CPAN
use strict;
use warnings;
use base qw/ Class::Accessor::Fast /;
__PACKAGE__->mk_accessors(qw/ key secret error status_code service debug signer error_response/);
use LWP::UserAgent;
use XML::Simple;
use URI::Escape;
use AWS::Signature4;
lib/Amazon/SNS/V4.pm view on Meta::CPAN
: $response->status_line
);
}
print STDERR 'ERROR: ', $self->error, "\n"
if $self->debug;
return undef;
}
sub timestamp {
lib/Amazon/SNS/V4.pm view on Meta::CPAN
=head2 $sns->secret('...')
Get/set secret.
=head2 $sns->debug
=head2 $sns->debug(1)
Get/set debug level. When set to 1 you'll get some debug output on STDERR.
=head1 NOTES
Be sure to use ARNs in the same region as you have set the service to.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SNS.pm view on Meta::CPAN
use strict;
use warnings;
use base qw/ Class::Accessor::Fast /;
__PACKAGE__->mk_accessors(qw/ key secret error status_code service debug /);
use LWP::UserAgent;
use XML::Simple;
use URI::Escape;
use Digest::SHA qw(hmac_sha256_base64);
lib/Amazon/SNS.pm view on Meta::CPAN
: $response->status_line
);
}
print STDERR 'ERROR: ', $self->error, "\n"
if $self->debug;
return undef;
}
sub timestamp {
lib/Amazon/SNS.pm view on Meta::CPAN
=item $sns->secret('...')
Get/set secret.
=item $sns->debug
=item $sns->debug(1)
Get/set debug level. When set to 1 you'll get some debug output on STDERR.
=back
=head1 NOTES
view all matches for this distribution
view release on metacpan or search on metacpan
bin/QueueDaemon.pl view on Meta::CPAN
$loglevel //= 'info';
$loglevel = {
error => $ERROR,
debug => $DEBUG,
trace => $TRACE,
info => $INFO,
warn => $WARN,
}->{ lc $loglevel };
bin/QueueDaemon.pl view on Meta::CPAN
--no-daemonize
-D, --delete-when never, always, error
-E, --exit-when never, always, error, false
-e, --endpoint-url default: https://sqs.amazonaws.com
-L, --logfile name of logfile
-l, --loglevel log level (trace, debug, info, warn, error)
-H, --handler name of the handler class, default: Amazon::SQS::QueueHandler
-m, --max-children not implemented (default: 1)
-s, --max-sleep-time default: 5 seconds
--max-messages fixed at 1 currently
-M, --message-type mime type of messages (text/plain, application/json,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Amazon/SQS/Consumer.pm view on Meta::CPAN
=item wait_seconds (optional)
The number of seconds to wait for a new message when the queue is empty.
=item debug (optional)
A flag to turn on debugging. It is turned off by default.
=back
=cut
lib/Amazon/SQS/Consumer.pm view on Meta::CPAN
sub delete_previous {
my $me = shift;
if ( $me->{DeleteMessageHandle} ) {
say "deleting message $me->{DeleteMessageHandle}" if $me->{debug};
$me->delete_message( Queue => $me->{queue}, ReceiptHandle => $me->{DeleteMessageHandle} );
}
}
sub defer { delete $_[0]->{DeleteMessageHandle} }
view all matches for this distribution