=== Changelog
==================================================================
--- Changelog (revision 1116)
+++ Changelog (local)
@@ -1,3 +1,7 @@
+ Added use Catalyst to REST.pm to make Makefile.PL PREREQ happy
+ All log->debug lines now check if $c->debug is enabled
+ Fixed undef warning in SerializeBase
+
Wed Jul 04 11:17:20 EDT 2007
Fixed 'default' serializer to set a valid Content-Type: header. Fixes
RT ticket 27949. Note that behavior has changed -- the default
=== lib/Catalyst/Action/Deserialize/Data/Serializer.pm
==================================================================
--- lib/Catalyst/Action/Deserialize/Data/Serializer.pm (revision 1116)
+++ lib/Catalyst/Action/Deserialize/Data/Serializer.pm (local)
@@ -24,7 +24,8 @@
require $sp
};
if ($@) {
- $c->log->debug("Could not load $serializer, refusing to serialize: $@");
+ $c->log->debug("Could not load $serializer, refusing to serialize: $@")
+ if $c->debug;
return 0;
}
my $body = $c->request->body;
@@ -48,7 +49,8 @@
$c->request->data($rdata);
} else {
$c->log->debug(
- 'I would have deserialized, but there was nothing in the body!');
+ 'I would have deserialized, but there was nothing in the body!')
+ if $c->debug;
}
return 1;
}
=== lib/Catalyst/Action/Deserialize/JSON.pm
==================================================================
--- lib/Catalyst/Action/Deserialize/JSON.pm (revision 1116)
+++ lib/Catalyst/Action/Deserialize/JSON.pm (local)
@@ -33,7 +33,8 @@
$c->request->data($rdata);
} else {
$c->log->debug(
- 'I would have deserialized, but there was nothing in the body!');
+ 'I would have deserialized, but there was nothing in the body!')
+ if $c->debug;
}
return 1;
}
=== lib/Catalyst/Action/Deserialize/XML/Simple.pm
==================================================================
--- lib/Catalyst/Action/Deserialize/XML/Simple.pm (revision 1116)
+++ lib/Catalyst/Action/Deserialize/XML/Simple.pm (local)
@@ -20,7 +20,8 @@
require XML::Simple;
};
if ($@) {
- $c->log->debug("Could not load XML::Simple, refusing to deserialize: $@");
+ $c->log->debug("Could not load XML::Simple, refusing to deserialize: $@")
+ if $c->debug;
return 0;
}
@@ -41,7 +42,8 @@
}
} else {
$c->log->debug(
- 'I would have deserialized, but there was nothing in the body!');
+ 'I would have deserialized, but there was nothing in the body!')
+ if $c->debug;
}
return 1;
}
=== lib/Catalyst/Action/Deserialize/YAML.pm
==================================================================
--- lib/Catalyst/Action/Deserialize/YAML.pm (revision 1116)
+++ lib/Catalyst/Action/Deserialize/YAML.pm (local)
@@ -29,7 +29,8 @@
$c->request->data($rdata);
} else {
$c->log->debug(
- 'I would have deserialized, but there was nothing in the body!');
+ 'I would have deserialized, but there was nothing in the body!')
+ if $c->debug;
}
return 1;
}
=== lib/Catalyst/Action/REST.pm
==================================================================
--- lib/Catalyst/Action/REST.pm (revision 1116)
+++ lib/Catalyst/Action/REST.pm (local)
@@ -11,6 +11,7 @@
use warnings;
use base 'Catalyst::Action';
+use Catalyst;
use Class::Inspector;
use Catalyst::Request::REST;
use 5.8.1;
=== lib/Catalyst/Action/Serialize/Data/Serializer.pm
==================================================================
--- lib/Catalyst/Action/Serialize/Data/Serializer.pm (revision 1116)
+++ lib/Catalyst/Action/Serialize/Data/Serializer.pm (local)
@@ -24,7 +24,8 @@
require $sp
};
if ($@) {
- $c->log->debug("Could not load $serializer, refusing to serialize: $@");
+ $c->log->debug("Could not load $serializer, refusing to serialize: $@")
+ if $c->debug;
return 0;
}
my $dso = Data::Serializer->new( serializer => $serializer );
=== lib/Catalyst/Action/Serialize/XML/Simple.pm
==================================================================
--- lib/Catalyst/Action/Serialize/XML/Simple.pm (revision 1116)
+++ lib/Catalyst/Action/Serialize/XML/Simple.pm (local)
@@ -20,7 +20,8 @@
require XML::Simple
};
if ($@) {
- $c->log->debug("Could not load XML::Serializer, refusing to serialize: $@");
+ $c->log->debug("Could not load XML::Serializer, refusing to serialize: $@")
+ if $c->debug;
return 0;
}
my $xs = XML::Simple->new(ForceArray => 0,);
=== lib/Catalyst/Action/Serialize.pm
==================================================================
--- lib/Catalyst/Action/Serialize.pm (revision 1116)
+++ lib/Catalyst/Action/Serialize.pm (local)
@@ -29,15 +29,18 @@
$controller, $c );
unless ( defined($sclass) ) {
if ( defined($content_type) ) {
- $c->log->debug("Could not find a serializer for $content_type");
+ $c->log->debug("Could not find a serializer for $content_type")
+ if $c->debug;
} else {
$c->log->debug(
- "Could not find a serializer for an empty content type");
+ "Could not find a serializer for an empty content type")
+ if $c->debug;
}
return 1;
}
$c->log->debug(
- "Serializing with $sclass" . ( $sarg ? " [$sarg]" : '' ) );
+ "Serializing with $sclass" . ( $sarg ? " [$sarg]" : '' ) )
+ if $c->debug;
my $rc;
if ( defined($sarg) ) {
=== lib/Catalyst/Action/SerializeBase.pm
==================================================================
--- lib/Catalyst/Action/SerializeBase.pm (revision 1116)
+++ lib/Catalyst/Action/SerializeBase.pm (local)
@@ -36,7 +36,7 @@
$self->_serialize_plugins( \@plugins );
}
- my $content_type = $c->request->preferred_content_type;
+ my $content_type = $c->request->preferred_content_type || '';
# Finally, we load the class. If you have a default serializer,
# and we still don't have a content-type that exists in the map,
=== lib/Catalyst/Controller/REST.pm
==================================================================
--- lib/Catalyst/Controller/REST.pm (revision 1116)
+++ lib/Catalyst/Controller/REST.pm (local)
@@ -351,7 +351,7 @@
my %p = validate( @_, { message => { type => SCALAR }, }, );
$c->response->status(400);
- $c->log->debug( "Status Bad Request: " . $p{'message'} );
+ $c->log->debug( "Status Bad Request: " . $p{'message'} ) if $c->debug;
$self->_set_entity( $c, { error => $p{'message'} } );
return 1;
}
@@ -377,7 +377,7 @@
my %p = validate( @_, { message => { type => SCALAR }, }, );
$c->response->status(404);
- $c->log->debug( "Status Not Found: " . $p{'message'} );
+ $c->log->debug( "Status Not Found: " . $p{'message'} ) if $c->debug;
$self->_set_entity( $c, { error => $p{'message'} } );
return 1;
}