AWS-SNS-Confess

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

---
abstract: 'Publish errors to an SNS topic'
author:
  - 'Tristan Havelick <tristan@havelick.com>'
build_requires:
  Amazon::SNS::Topic: 0
  Data::Dumper: 0
  FindBin: 0
  Test::Exception: 0
  Test::More: 0
configure_requires:
  ExtUtils::MakeMaker: 6.30

Makefile.PL  view on Meta::CPAN

use strict;
use warnings;



use ExtUtils::MakeMaker 6.30;



my %WriteMakefileArgs = (
  "ABSTRACT" => "Publish errors to an SNS topic",
  "AUTHOR" => "Tristan Havelick <tristan\@havelick.com>",
  "BUILD_REQUIRES" => {
    "Amazon::SNS::Topic" => 0,
    "Data::Dumper" => 0,
    "FindBin" => 0,
    "Test::Exception" => 0,
    "Test::More" => 0
  },
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => "6.30"

README  view on Meta::CPAN



This archive contains the distribution AWS-SNS-Confess,
version 0.001:

  Publish errors to an SNS topic

This software is copyright (c) 2012 by Tristan Havelick.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.


README.markdown  view on Meta::CPAN

      access_key_id => 'E654SAKIASDD64ERAF0O',
      secret_access_key => 'LgTZ25nCD+9LiCV6ujofudY1D6e2vfK0R4GLsI4H'
      topic => 'arn:aws:sns:us-east-1:738734873:YourTopic',
    );
    confess "Something went wrong";



# DESCRIPTION

AWS::SNS::Confess uses [Amazon::SNS](http://search.cpan.org/perldoc?Amazon::SNS) to post any errors to an Amazon SNS
feed for more robust management from there.



# PUBLIC METHODS

## setup( access_key_id => $aws_access_key_id, secret_access_key => $aws_secret_access_key, topic => $aws_topic );

Sets up to send errors to the given AWS Account and Topic

## confess( $msg );

Publishes the given error message to SNS with a full stack trace

# SEE ALSO

[Amazon::SNS](http://search.cpan.org/perldoc?Amazon::SNS)

[Carp](http://search.cpan.org/perldoc?Carp)

lib/AWS/SNS/Confess.pm  view on Meta::CPAN

package AWS::SNS::Confess;
# ABSTRACT: Publish errors to an SNS topic

use base 'Exporter';
use Amazon::SNS;
use Devel::StackTrace;
use strict;
use warnings 'all';

our @EXPORT_OK = qw/confess/;

our ($access_key_id, $secret_access_key, $topic, $sns, $sns_topic);

lib/AWS/SNS/Confess.pm  view on Meta::CPAN


1;



__END__
=pod

=head1 NAME

AWS::SNS::Confess - Publish errors to an SNS topic

=head1 VERSION

version 0.001

=head1 SYNOPSIS

  use AWS::SNS::Confess 'confess';
  AWS::SNS::Confess::setup(
    access_key_id => 'E654SAKIASDD64ERAF0O',
    secret_access_key => 'LgTZ25nCD+9LiCV6ujofudY1D6e2vfK0R4GLsI4H'
    topic => 'arn:aws:sns:us-east-1:738734873:YourTopic',
  );
  confess "Something went wrong";

=head1 DESCRIPTION

AWS::SNS::Confess uses L<Amazon::SNS> to post any errors to an Amazon SNS
feed for more robust management from there.

=head1 NAME

AWS::S3 - Publish Errors, with a full stack trace to an Amazon SNS
topic

=head1 PUBLIC METHODS

=head2 setup( access_key_id => $aws_access_key_id, secret_access_key => $aws_secret_access_key, topic => $aws_topic );

Sets up to send errors to the given AWS Account and Topic

=head2 confess( $msg );

Publishes the given error message to SNS with a full stack trace

=head1 SEE ALSO

L<Amazon::SNS>

L<Carp>

=head1 AUTHOR

Tristan Havelick <tristan@havelick.com>

t/basic.t  view on Meta::CPAN


SEND_TO_SNS: {
  AWS::SNS::Confess::_send_msg("Hello");
  is $sns->GetTopic($topic_name)->LastLogEntry(), "Hello";
}

CONFESSS: {
  can_ok('main', 'confess');
  dies_ok { confess("something went wrong") } "confess correctly dies";
  my $last_msg =  $sns->GetTopic($topic_name)->LastLogEntry();
  like $last_msg, qr/something went wrong/, "sns msg contains error passed in";
  like $last_msg, qr/Trace begun/, "sns msg contains stack trace";
}





( run in 0.683 second using v1.01-cache-2.11-cpan-65fba6d93b7 )