Acme-Crap
view release on metacpan or search on metacpan
lib/Acme/Crap.pm view on Meta::CPAN
goto &Carp::carp;
}
}
package Acme::Crap::Negated;
sub new {
my ($class, $val) = @_;
bless { val => $val, degree => 1 }, $class;
}
sub value {
my ($self) = @_;
if ($Acme::Crap::no_negation) {
return $self->{degree} == 1 ? ucfirst "$self->{val}!"
: $self->{degree} == 2 ? join q{}, map { ucfirst $_ } split /(\s+)/, "$self->{val}!!"
: uc $self->{val} . '!' x $self->{degree};
}
return !$self->{val} if $self->{degree} % 2;
return !!$self->{val};
}
use overload (
q{!} => sub { my ($self) = @_; $self->{degree}++; return $self; },
q{""} => \&value,
q{0+} => \&value,
q{bool} => \&value,
fallback => 1,
);
1; # Magic true value required at end of module
__END__
=head1 NAME
Acme::Crap - Carp with more feeling
=head1 VERSION
This document describes Acme::Crap version 0.001003
=head1 SYNOPSIS
use Acme::Crap;
crap "there was a problem";
crap! "there was a bad problem";
crap!! "there was a really bad problem";
crap!!! "there was a really very bad problem";
=head1 DESCRIPTION
Load the module. Now you can spell C<carp> more scatologically, and with
as many trailing exclamation marks as you need to satisfy your degree of
frustration.
=head1 INTERFACE
Always exports the C<crap> subroutine, which works just like
C<carp> but allows trailing exclamation marks on the sub name,
for emphasis.
=head1 DIAGNOSTICS
None. C<crap> I<is> a diagnostic.
=head1 CONFIGURATION AND ENVIRONMENT
Acme::Crap requires no configuration files or environment variables.
=head1 DEPENDENCIES
None.
=head1 INCOMPATIBILITIES
Uses string constant overloading, so potentially incompatible with all
other modules that use string constant overloading.
No actual incompatibilities reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-acme-crap@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Damian Conway C<< <DCONWAY@cpan.org> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2010, Damian Conway C<< <DCONWAY@cpan.org> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
( run in 1.403 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )