Permalink
Browse files

Merge branch 'release/1.2000_02'

  • Loading branch information...
2 parents a67fa01 + cc7adf0 commit 0e0af92df0f56c6d382e81e9f0df8e01327c76d6 @xsawyerx xsawyerx committed Nov 30, 2010
Showing with 49 additions and 26 deletions.
  1. +15 −0 CHANGES
  2. +4 −6 MANIFEST
  3. +1 −1 lib/Dancer.pm
  4. +4 −5 lib/Dancer/Config.pm
  5. +19 −6 lib/Dancer/Cookbook.pod
  6. +2 −2 lib/Dancer/FileUtils.pm
  7. +0 −1 lib/Dancer/Handler/Debug.pm
  8. +0 −3 lib/Dancer/Serializer/Dumper.pm
  9. +4 −2 script/dancer
View
15 CHANGES
@@ -1,3 +1,18 @@
+Dancer 1.2001
+ [ Sawyer X ]
+ * Fix clash with KiokuDB because of Dancer::Serializer::Dumper.
+
+ [ Franck Cuny ]
+ * Refactoring engine triggers. This resolves an issue of engine inits being
+ run before all configuration is read. That also crashes D::S::Cookie.
+ As a side effect we now have a refactored _set_setting() which does not
+ trigger any engine hooks (unlike setting()).
+ * Fix failing test t/07_apphandlers/06_debug.t
+
+ [ David Precious ]
+ * Doc fixes. Clarifications to Cookbook's REST section.
+ * Don't crash if application name is invalid and provide better information.
+
Dancer 1.2000
** 1.2 is a stable release of Dancer **
** We assure consistency and stability for this release and the following **
View
10 MANIFEST
@@ -83,20 +83,17 @@ t/00_base/09_load_app.t
t/00_base/11_file_utils.t
t/00_base/12_utf8_charset.t
t/00_base/config.t
-t/00_base/dance_start.t
t/00_base/dancer_test.t
t/00_base/lib/AppWithError.pm
t/00_base/lib/WorkingApp.pm
-t/00_base/utf8.tt
-t/00_base/views/unicode.tt
t/00_base/uri_for.t
t/00_base/utf8.tt
+t/00_base/views/unicode.tt
t/01_config/01_settings.t
t/01_config/02_mime_type.t
t/01_config/03_logger.t
t/01_config/04_config_file.t
t/01_config/05_serializers.t
-t/01_config/05_serialiers.t
t/01_config/06_config_api.t
t/01_config/06_stack_trace.t
t/01_config/environments/development.pl
@@ -179,8 +176,9 @@ t/07_apphandlers/02_apache2_plack.t
t/07_apphandlers/03_psgi_app.t
t/07_apphandlers/04_standalone_app.t
t/07_apphandlers/05_middlewares.t
-t/08_session/000_create_fake_env.t
t/07_apphandlers/05_psgi_api.t
+t/07_apphandlers/06_debug.t
+t/08_session/000_create_fake_env.t
t/08_session/01_load.t
t/08_session/02_dependency_check.t
t/08_session/03_http_requests.t
@@ -239,8 +237,8 @@ t/15_plugins/01_register.t
t/15_plugins/02_config.t
t/15_plugins/03_namespace.t
t/15_plugins/04_apps_and_plugins.t
-t/15_plugins/05_plugins_and_OO.t
t/15_plugins/05_keywords.t
+t/15_plugins/05_plugins_and_OO.t
t/15_plugins/06_hook.t
t/16_timer/00_base.t
t/16_timer/02_hires.t
View
2 lib/Dancer.pm
@@ -31,7 +31,7 @@ use File::Basename 'basename';
use base 'Exporter';
$AUTHORITY = 'SUKRIA';
-$VERSION = '1.2000';
+$VERSION = '1.2000_02';
@EXPORT = qw(
after
any
View
9 lib/Dancer/Config.pm
@@ -174,18 +174,17 @@ sub load_settings_from_yaml {
my $config;
eval { $config = YAML::LoadFile($file) };
- if ( my $err = $@ || (!$config)) {
+ if (my $err = $@ || (!$config)) {
confess "Unable to parse the configuration file: $file: $@";
}
for my $key (keys %{$config}) {
if ($MERGEABLE{$key}) {
my $setting = setting($key);
- $setting->{$_} = $config->{$key}{$_}
- for keys %{$config->{$key}};
+ $setting->{$_} = $config->{$key}{$_} for keys %{$config->{$key}};
}
else {
- setting($key, $config->{$key});
+ _set_setting($key, $config->{$key});
}
}
@@ -208,7 +207,7 @@ sub load_default_settings {
|| $ENV{PLACK_ENV}
|| 'development';
- setting $_ => {} for keys %MERGEABLE;
+ setting $_ => {} for keys %MERGEABLE;
setting template => 'simple';
setting import_warnings => 1;
}
View
25 lib/Dancer/Cookbook.pod
@@ -666,7 +666,8 @@ Just call C<debug>, C<warning> or C<error> with your message:
=head2 Writing a REST application
-With Dancer, it's easy to write REST application. Dancer provides helpers to serialize and deserialize for the following data format:
+With Dancer, it's easy to write REST applications. Dancer provides helpers to
+serialize and deserialize for the following data formats:
=over 4
@@ -680,21 +681,33 @@ With Dancer, it's easy to write REST application. Dancer provides helpers to ser
=back
-To activate this feature, you only have to write this:
+To activate this feature, you only have to set the C<serializer> setting to the
+format you require, for instance in your config.yml:
- serializer => 'JSON'
+ serializer: JSON
-From now, all hash ref or array ref returned by a route will be serialized to JSON. And all data receive from B<POST> or B<PUT> will be deserialized from JSON.
+Or right in your code:
+
+ set serializer => 'JSON';
+
+From now, all hash ref or array ref returned by a route will be serialized to
+the format you chose, and all data received from B<POST> or B<PUT> requests
+will be automatically deserialized.
get '/hello/:name' => sub {
# this structure will be returned to the client as
# {"name":"$name"}
return {name => params->{name}};
};
-It's possible to let the client choose which serializer he want to use. For this, use the B<mutable> serializer, and an appropriate serializer will be chosen from the B<Content-Type> header.
+It's possible to let the client choose which serializer he want to use. For
+this, use the B<mutable> serializer, and an appropriate serializer will be
+chosen from the B<Content-Type> header.
-It's also possible to return custom error, using the C<send_error> function. When you don't use a serializer, the C<send_error> function will take a string as first parameter (the message), and an optional HTTP code. When using a serializer, the message can be a string, an arrayref or a hashref:
+It's also possible to return custom error, using the C<send_error> function.
+When you don't use a serializer, the C<send_error> function will take a string
+as first parameter (the message), and an optional HTTP code. When using a
+serializer, the message can be a string, an arrayref or a hashref:
get '/hello/:name' => sub {
if (...) {
View
4 lib/Dancer/FileUtils.pm
@@ -100,9 +100,9 @@ in case it failed to open the file.
open my $fh, '<', $file or die "$!\n";
my $content = read_glob_content($fh);
-Same as I<read_file_content>, only it accepts a file handler.
+Same as I<read_file_content>, only it accepts a file handle.
-Returns the content and B<closes the file handler>.
+Returns the content and B<closes the file handle>.
=head1 EXPORT
View
1 lib/Dancer/Handler/Debug.pm
@@ -8,7 +8,6 @@ use HTTP::Server::Simple::PSGI;
use base 'Dancer::Object', 'Dancer::Handler', 'HTTP::Server::Simple::PSGI';
use Dancer::Config 'setting';
-use Dancer::Headers;
use Dancer::SharedData;
sub run {
View
3 lib/Dancer/Serializer/Dumper.pm
@@ -6,9 +6,6 @@ use Carp;
use base 'Dancer::Serializer::Abstract';
use Data::Dumper;
-# we want to eval serialized strings
-$Data::Dumper::Purity = 1;
-
sub from_dumper {
my ($string) = @_;
my $s = Dancer::Serializer::Dumper->new;
View
6 script/dancer
@@ -59,8 +59,10 @@ create_node( app_tree($name), $DANCER_APP_DIR );
sub validate_app_name {
my $name = shift;
if ($name =~ /[^\w:]/ || $name =~ /^\d/ || $name =~ /\b:\b|:{3,}/) {
- warn "Error: Invalid application name.\n";
- usage();
+ print STDERR "Error: Invalid application name.\n";
+ print STDERR "Application names must not contain colons,"
+ ." dots or start with a number.\n";
+ exit;
}
}

0 comments on commit 0e0af92

Please sign in to comment.