Acme-Throw

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

---
abstract: 'For when code makes you want to throw something.'
author:
  - 'Steve Scaffidi <sscaffidi@cpan.org>'
build_requires: {}
configure_requires:
  ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.133380'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html

Makefile.PL  view on Meta::CPAN

use strict;
use warnings;



use ExtUtils::MakeMaker 6.30;



my %WriteMakefileArgs = (
  "ABSTRACT" => "For when code makes you want to throw something.",
  "AUTHOR" => "Steve Scaffidi <sscaffidi\@cpan.org>",
  "BUILD_REQUIRES" => {},
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => "6.30"
  },
  "DISTNAME" => "Acme-Throw",
  "EXE_FILES" => [],
  "LICENSE" => "perl",
  "NAME" => "Acme::Throw",
  "PREREQ_PM" => {},

README  view on Meta::CPAN



This archive contains the distribution Acme-Throw,
version 0.002:

  For when code makes you want to throw something.

This software is copyright (c) 2013 by Stephen R. Scaffidi.

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


lib/Acme/Throw.pm  view on Meta::CPAN

use strict;
use warnings;
package Acme::Throw;

# ABSTRACT: For when code makes you want to throw something.

use utf8;

our $MSG;

sub import {
  my ($class, %args) = @_;

  $MSG = $args{-msg} || "WHY WON'T THIS CODE WORK??!?";
  my $orig_handler = $SIG{__DIE__};

lib/Acme/Throw.pm  view on Meta::CPAN

  };
}

sub _msg { $MSG }

1 && q{ THIS IS MY RAGE FACE }; # truth
__END__

=head1 NAME

Acme::Throw - For when code makes you want to throw something.

=head1 SYNOPSIS

  use Acme::Throw;
  # code that does stuff...
  die "something bad happened"

Alternatively,

  perl -MAcme::Throw /path/to/program.pl

t/simple.t  view on Meta::CPAN

use Capture::Tiny qw/ capture_stderr /; # bundled under t/lib

# make sure all test output supports utf
binmode( \$_, ":utf8" ) for *STDERR, *STDOUT;
$_->autoflush(1) for *STDERR, *STDOUT;

our $CLASS = "Acme::Throw";
use_ok $CLASS;
$CLASS->import;

# throw and catch an exception
my $die_msg = "your mom";
my ($got_val, $got_err);
my $stderr = capture_stderr {
  $got_val = eval { die "$die_msg\n"; };
  $got_err = $@;
};

# make sure die still worked
is $got_val, undef, "die didn't break";



( run in 0.270 second using v1.01-cache-2.11-cpan-8d75d55dd25 )