Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Crap::croak doesn't work; strange... it looks right

  • Loading branch information...
commit 84abb777f67b7e94fa05609315b6326f3867723d 1 parent 3e8c3e6
@rwstauner authored
View
3  Changes
@@ -2,6 +2,9 @@ Revision history for AnyEvent-HTTP-Message
{{$NEXT}}
+ - Fix module name typo when parse_args throws an error.
+ (While "Crap" would be an appropriate name, it's actually "Carp".)
+
0.100 2012-04-19T01:28:25Z
- Initial release
View
2  lib/AnyEvent/HTTP/Request.pm
@@ -59,7 +59,7 @@ C<< ($method, $uri, %params, \&callback) >>.
sub parse_args {
my $self = shift;
- Crap::croak( join ' ',
+ Carp::croak( join ' ',
(ref($self) || $self),
q[expects an odd number of arguments:],
q[($method, $uri, (key => value, ...)*, \&callback)]
View
2  lib/AnyEvent/HTTP/Response.pm
@@ -74,7 +74,7 @@ and pseudo headers start with an upper case letter).
sub parse_args {
my $self = shift;
- Crap::croak(
+ Carp::croak(
(ref($self) || $self) .
q[ expects two arguments: ($content_body, \%headers)]
)
View
6 t/request.t
@@ -12,6 +12,12 @@ local *AnyEvent::HTTP::http_request = sub ($$@) {
};
use warnings;
+# parse_args error
+foreach my $args ( [], [1,2], [1,2,3,4] ){
+ is eval { $mod->parse_args(@$args) }, undef, 'wrong number of args';
+ like $@, qr/expects an odd number of arguments/, 'error message';
+}
+
# basic request
{
my $cb = sub { 'ugly' };
View
6 t/response.t
@@ -5,6 +5,12 @@ use Test::More 0.88;
my $mod = 'AnyEvent::HTTP::Response';
eval "require $mod" or die $@;
+# parse_args error
+foreach my $args ( [1], [1,2,3] ){
+ is eval { $mod->parse_args(@$args) }, undef, 'wrong number of args';
+ like $@, qr/expects two arguments/, 'error message';
+}
+
# not much to test here, just order of args
{
my $body = "black\nparade";
Please sign in to comment.
Something went wrong with that request. Please try again.