@@ -20,7 +20,7 @@ my %module_build_args = (
"Dancer Core Developers"
],
"dist_name" => "Dancer2",
- "dist_version" => "0.141000",
+ "dist_version" => "0.143000",
"license" => "perl",
"module_name" => "Dancer2",
"recommends" => {
@@ -1,3 +1,28 @@
+0.143000 2014-07-05 21:39:28CEST+0200 Europe/Amsterdam
+
+ [ BUG FIXES ]
+ * GH #538, #539: Coerce propogated exceptions to strings within Error object.
+ (Steven Humphrey)
+ * GH #531: Generate valid HTML when show_errors is true from Error objects.
+ (Steven Humphrey)
+ * GH #603: Update skeleton test to use Plack::Test. (Sawyer X)
+
+ [ ENHANCEMENTS ]
+ * Provide psgi_app in top-level Dancer.pm to make it easier to change it.
+ (Sawyer X)
+
+0.142000 2014-06-24 15:16:42CEST+0200 Europe/Amsterdam
+
+ [ BUG FIXES ]
+ * GH #550, #555: Allow the content type to be set when using send_file
+ as per the documentation. (Russell Jenkins, Steven Humphrey)
+
+ [ ENHANCEMENTS ]
+ * GH #512, #520, #602: Pass all settings into JSON serializer engine.
+ (Jakob Voss, Russell Jenkins)
+ * GH #532: Serialize runtime errors such as those produced by die if a
+ serializer exists. (Steven Humphrey)
+
0.141000 2014-06-08 22:27:03CEST+0200 Europe/Amsterdam
* No functional changes.
@@ -231,6 +231,8 @@ t/sessions/U4dFuQAASvRTfhriav1JejXrIpcGPEZu.yml
t/sessions/U4dHNwAAURLdtNi0IuajTgmkXFQfvjrA.yml
t/sessions/U4dhegAAAw5gU_GDhdYOAgg7AtnGvHoB.yml
t/sessions/U4uQKwAAc0S31MjwWDgsnGg-wkwCcUp-.yml
+t/sessions/U7g83AAAD40GMDKZZbYNAi9jRU6lJlmd.yml
+t/sessions/U7hR3AAAME4JbYM_IBVWT5sQq-OlHt5v.yml
t/sessions/Uf-CrAAAdd2mP4pJAIBzc6YRqXnqeNUt.yml
t/sessions/Uf-GsQAANz9OaEztWyuSfJKegUq3zD1V.yml
t/sessions/Uf-HDgAAPPOeyDGX2_IgTLzBg6iBsFkk.yml
@@ -137,255 +137,255 @@
"provides" : {
"Dancer2" : {
"file" : "lib/Dancer2.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::CLI" : {
"file" : "lib/Dancer2/CLI.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::CLI::Command::gen" : {
"file" : "lib/Dancer2/CLI/Command/gen.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::CLI::Command::version" : {
"file" : "lib/Dancer2/CLI/Command/version.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Config" : {
"file" : "lib/Dancer2/Config.pod",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Cookbook" : {
"file" : "lib/Dancer2/Cookbook.pod",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core" : {
"file" : "lib/Dancer2/Core.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::App" : {
"file" : "lib/Dancer2/Core/App.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Context" : {
"file" : "lib/Dancer2/Core/Context.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Cookie" : {
"file" : "lib/Dancer2/Core/Cookie.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::DSL" : {
"file" : "lib/Dancer2/Core/DSL.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Dispatcher" : {
"file" : "lib/Dancer2/Core/Dispatcher.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Error" : {
"file" : "lib/Dancer2/Core/Error.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Factory" : {
"file" : "lib/Dancer2/Core/Factory.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::HTTP" : {
"file" : "lib/Dancer2/Core/HTTP.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Hook" : {
"file" : "lib/Dancer2/Core/Hook.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::MIME" : {
"file" : "lib/Dancer2/Core/MIME.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Request" : {
"file" : "lib/Dancer2/Core/Request.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Request::Upload" : {
"file" : "lib/Dancer2/Core/Request/Upload.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Response" : {
"file" : "lib/Dancer2/Core/Response.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::ConfigReader" : {
"file" : "lib/Dancer2/Core/Role/ConfigReader.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::DSL" : {
"file" : "lib/Dancer2/Core/Role/DSL.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Engine" : {
"file" : "lib/Dancer2/Core/Role/Engine.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Handler" : {
"file" : "lib/Dancer2/Core/Role/Handler.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Headers" : {
"file" : "lib/Dancer2/Core/Role/Headers.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Hookable" : {
"file" : "lib/Dancer2/Core/Role/Hookable.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Logger" : {
"file" : "lib/Dancer2/Core/Role/Logger.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Serializer" : {
"file" : "lib/Dancer2/Core/Role/Serializer.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::SessionFactory" : {
"file" : "lib/Dancer2/Core/Role/SessionFactory.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::SessionFactory::File" : {
"file" : "lib/Dancer2/Core/Role/SessionFactory/File.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::StandardResponses" : {
"file" : "lib/Dancer2/Core/Role/StandardResponses.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Role::Template" : {
"file" : "lib/Dancer2/Core/Role/Template.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Route" : {
"file" : "lib/Dancer2/Core/Route.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Runner" : {
"file" : "lib/Dancer2/Core/Runner.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Session" : {
"file" : "lib/Dancer2/Core/Session.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Time" : {
"file" : "lib/Dancer2/Core/Time.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Core::Types" : {
"file" : "lib/Dancer2/Core/Types.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::FileUtils" : {
"file" : "lib/Dancer2/FileUtils.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Handler::AutoPage" : {
"file" : "lib/Dancer2/Handler/AutoPage.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Handler::File" : {
"file" : "lib/Dancer2/Handler/File.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::Capture" : {
"file" : "lib/Dancer2/Logger/Capture.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::Capture::Trap" : {
"file" : "lib/Dancer2/Logger/Capture/Trap.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::Console" : {
"file" : "lib/Dancer2/Logger/Console.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::Diag" : {
"file" : "lib/Dancer2/Logger/Diag.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::File" : {
"file" : "lib/Dancer2/Logger/File.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::Note" : {
"file" : "lib/Dancer2/Logger/Note.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Logger::Null" : {
"file" : "lib/Dancer2/Logger/Null.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Manual" : {
"file" : "lib/Dancer2/Manual.pod",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Plugin" : {
"file" : "lib/Dancer2/Plugin.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Plugin::Ajax" : {
"file" : "lib/Dancer2/Plugin/Ajax.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Plugins" : {
"file" : "lib/Dancer2/Plugins.pod",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Serializer::Dumper" : {
"file" : "lib/Dancer2/Serializer/Dumper.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Serializer::JSON" : {
"file" : "lib/Dancer2/Serializer/JSON.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Serializer::Mutable" : {
"file" : "lib/Dancer2/Serializer/Mutable.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Serializer::YAML" : {
"file" : "lib/Dancer2/Serializer/YAML.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Session::Simple" : {
"file" : "lib/Dancer2/Session/Simple.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Session::YAML" : {
"file" : "lib/Dancer2/Session/YAML.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Template::Implementation::ForkedTiny" : {
"file" : "lib/Dancer2/Template/Implementation/ForkedTiny.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Template::Simple" : {
"file" : "lib/Dancer2/Template/Simple.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Template::TemplateToolkit" : {
"file" : "lib/Dancer2/Template/TemplateToolkit.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Template::Tiny" : {
"file" : "lib/Dancer2/Template/Tiny.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Test" : {
"file" : "lib/Dancer2/Test.pm",
- "version" : "0.141000"
+ "version" : "0.143000"
},
"Dancer2::Tutorial" : {
"file" : "lib/Dancer2/Tutorial.pod",
- "version" : "0.141000"
+ "version" : "0.143000"
}
},
"release_status" : "stable",
@@ -398,6 +398,6 @@
"url" : "https://github.com/PerlDancer/Dancer2"
}
},
- "version" : "0.141000"
+ "version" : "0.143000"
}
@@ -40,193 +40,193 @@ name: Dancer2
provides:
Dancer2:
file: lib/Dancer2.pm
- version: 0.141000
+ version: 0.143000
Dancer2::CLI:
file: lib/Dancer2/CLI.pm
- version: 0.141000
+ version: 0.143000
Dancer2::CLI::Command::gen:
file: lib/Dancer2/CLI/Command/gen.pm
- version: 0.141000
+ version: 0.143000
Dancer2::CLI::Command::version:
file: lib/Dancer2/CLI/Command/version.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Config:
file: lib/Dancer2/Config.pod
- version: 0.141000
+ version: 0.143000
Dancer2::Cookbook:
file: lib/Dancer2/Cookbook.pod
- version: 0.141000
+ version: 0.143000
Dancer2::Core:
file: lib/Dancer2/Core.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::App:
file: lib/Dancer2/Core/App.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Context:
file: lib/Dancer2/Core/Context.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Cookie:
file: lib/Dancer2/Core/Cookie.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::DSL:
file: lib/Dancer2/Core/DSL.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Dispatcher:
file: lib/Dancer2/Core/Dispatcher.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Error:
file: lib/Dancer2/Core/Error.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Factory:
file: lib/Dancer2/Core/Factory.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::HTTP:
file: lib/Dancer2/Core/HTTP.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Hook:
file: lib/Dancer2/Core/Hook.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::MIME:
file: lib/Dancer2/Core/MIME.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Request:
file: lib/Dancer2/Core/Request.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Request::Upload:
file: lib/Dancer2/Core/Request/Upload.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Response:
file: lib/Dancer2/Core/Response.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::ConfigReader:
file: lib/Dancer2/Core/Role/ConfigReader.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::DSL:
file: lib/Dancer2/Core/Role/DSL.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Engine:
file: lib/Dancer2/Core/Role/Engine.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Handler:
file: lib/Dancer2/Core/Role/Handler.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Headers:
file: lib/Dancer2/Core/Role/Headers.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Hookable:
file: lib/Dancer2/Core/Role/Hookable.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Logger:
file: lib/Dancer2/Core/Role/Logger.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Serializer:
file: lib/Dancer2/Core/Role/Serializer.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::SessionFactory:
file: lib/Dancer2/Core/Role/SessionFactory.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::SessionFactory::File:
file: lib/Dancer2/Core/Role/SessionFactory/File.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::StandardResponses:
file: lib/Dancer2/Core/Role/StandardResponses.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Role::Template:
file: lib/Dancer2/Core/Role/Template.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Route:
file: lib/Dancer2/Core/Route.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Runner:
file: lib/Dancer2/Core/Runner.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Session:
file: lib/Dancer2/Core/Session.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Time:
file: lib/Dancer2/Core/Time.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Core::Types:
file: lib/Dancer2/Core/Types.pm
- version: 0.141000
+ version: 0.143000
Dancer2::FileUtils:
file: lib/Dancer2/FileUtils.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Handler::AutoPage:
file: lib/Dancer2/Handler/AutoPage.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Handler::File:
file: lib/Dancer2/Handler/File.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::Capture:
file: lib/Dancer2/Logger/Capture.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::Capture::Trap:
file: lib/Dancer2/Logger/Capture/Trap.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::Console:
file: lib/Dancer2/Logger/Console.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::Diag:
file: lib/Dancer2/Logger/Diag.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::File:
file: lib/Dancer2/Logger/File.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::Note:
file: lib/Dancer2/Logger/Note.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Logger::Null:
file: lib/Dancer2/Logger/Null.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Manual:
file: lib/Dancer2/Manual.pod
- version: 0.141000
+ version: 0.143000
Dancer2::Plugin:
file: lib/Dancer2/Plugin.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Plugin::Ajax:
file: lib/Dancer2/Plugin/Ajax.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Plugins:
file: lib/Dancer2/Plugins.pod
- version: 0.141000
+ version: 0.143000
Dancer2::Serializer::Dumper:
file: lib/Dancer2/Serializer/Dumper.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Serializer::JSON:
file: lib/Dancer2/Serializer/JSON.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Serializer::Mutable:
file: lib/Dancer2/Serializer/Mutable.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Serializer::YAML:
file: lib/Dancer2/Serializer/YAML.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Session::Simple:
file: lib/Dancer2/Session/Simple.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Session::YAML:
file: lib/Dancer2/Session/YAML.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Template::Implementation::ForkedTiny:
file: lib/Dancer2/Template/Implementation/ForkedTiny.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Template::Simple:
file: lib/Dancer2/Template/Simple.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Template::TemplateToolkit:
file: lib/Dancer2/Template/TemplateToolkit.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Template::Tiny:
file: lib/Dancer2/Template/Tiny.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Test:
file: lib/Dancer2/Test.pm
- version: 0.141000
+ version: 0.143000
Dancer2::Tutorial:
file: lib/Dancer2/Tutorial.pod
- version: 0.141000
+ version: 0.143000
recommends:
CGI::Deurl::XS: 0
Crypt::URandom: 0
@@ -297,4 +297,4 @@ resources:
bugtracker: https://github.com/PerlDancer/Dancer2/issues
homepage: http://perldancer.org/
repository: https://github.com/PerlDancer/Dancer2
-version: 0.141000
+version: 0.143000
@@ -106,7 +106,7 @@ my %WriteMakefileArgs = (
"utf8" => 0,
"vars" => 0
},
- "VERSION" => "0.141000",
+ "VERSION" => "0.143000",
"test" => {
"TESTS" => "t/*.t t/dsl/*.t t/logger/*.t t/roles/*.t t/route-pod-coverage/*.t t/template_tiny/*.t"
}
@@ -1,6 +1,6 @@
# ABSTRACT: create new Dancer2 application
package Dancer2::CLI::Command::gen;
-$Dancer2::CLI::Command::gen::VERSION = '0.141000';
+$Dancer2::CLI::Command::gen::VERSION = '0.143000';
use strict;
use warnings;
@@ -277,7 +277,7 @@ Dancer2::CLI::Command::gen - create new Dancer2 application
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,6 +1,6 @@
package Dancer2::CLI::Command::version;
# ABSTRACT: display version
-$Dancer2::CLI::Command::version::VERSION = '0.141000';
+$Dancer2::CLI::Command::version::VERSION = '0.143000';
use App::Cmd::Setup -command;
sub description { 'Display version of Dancer2' }
@@ -27,7 +27,7 @@ Dancer2::CLI::Command::version - display version
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,6 +1,6 @@
# ABSTRACT: Dancer2 cli application
package Dancer2::CLI;
-$Dancer2::CLI::VERSION = '0.141000';
+$Dancer2::CLI::VERSION = '0.143000';
use App::Cmd::Setup -app;
1;
@@ -15,7 +15,7 @@ Dancer2::CLI - Dancer2 cli application
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,6 +1,6 @@
package Dancer2::Config;
# ABSTRACT: Configure Dancer2 to suit your needs
-$Dancer2::Config::VERSION = '0.141000';
+$Dancer2::Config::VERSION = '0.143000';
__END__
=pod
@@ -11,7 +11,7 @@ Dancer2::Config - Configure Dancer2 to suit your needs
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Cookbook;
# ABSTRACT: Example-driven quick-start to the Dancer2 web framework
-$Dancer2::Cookbook::VERSION = '0.141000';
+$Dancer2::Cookbook::VERSION = '0.143000';
__END__
=pod
@@ -11,7 +11,7 @@ Dancer2::Cookbook - Example-driven quick-start to the Dancer2 web framework
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
# ABSTRACT: encapsulation of Dancer2 packages
package Dancer2::Core::App;
-$Dancer2::Core::App::VERSION = '0.141000';
+$Dancer2::Core::App::VERSION = '0.143000';
use Moo;
use Carp 'croak';
use List::Util 'first';
@@ -726,7 +726,7 @@ Dancer2::Core::App - encapsulation of Dancer2 packages
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Core::Context;
-$Dancer2::Core::Context::VERSION = '0.141000';
+$Dancer2::Core::Context::VERSION = '0.143000';
# ABSTRACT: handles everything proper to a request's context.
use Moo;
@@ -242,7 +242,7 @@ Dancer2::Core::Context - handles everything proper to a request's context.
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 ATTRIBUTES
@@ -1,6 +1,6 @@
package Dancer2::Core::Cookie;
# ABSTRACT: A cookie representing class
-$Dancer2::Core::Cookie::VERSION = '0.141000';
+$Dancer2::Core::Cookie::VERSION = '0.143000';
use Moo;
use URI::Escape;
use Dancer2::Core::Types;
@@ -116,7 +116,7 @@ Dancer2::Core::Cookie - A cookie representing class
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,7 +1,7 @@
# ABSTRACT: Dancer2's Domain Specific Language (DSL)
package Dancer2::Core::DSL;
-$Dancer2::Core::DSL::VERSION = '0.141000';
+$Dancer2::Core::DSL::VERSION = '0.143000';
use Moo;
use Carp;
use Class::Load 'load_class';
@@ -380,7 +380,7 @@ Dancer2::Core::DSL - Dancer2's Domain Specific Language (DSL)
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 FUNCTIONS
@@ -1,6 +1,6 @@
package Dancer2::Core::Dispatcher;
# ABSTRACT: Class for dispatching request to the appropriate route handler
-$Dancer2::Core::Dispatcher::VERSION = '0.141000';
+$Dancer2::Core::Dispatcher::VERSION = '0.143000';
use Moo;
use Encode;
@@ -16,12 +16,6 @@ has apps => (
default => sub { [] },
);
-has default_content_type => (
- is => 'ro',
- isa => Str,
- default => sub {'text/html'},
-);
-
# take the list of applications and an $env hash, return a Response object.
sub dispatch {
my ( $self, $env, $request, $curr_context ) = @_;
@@ -128,23 +122,18 @@ sub _dispatch_route {
}
}
- # routes should use 'content_type' as default, or 'text/html'
- # (Content-Type header needs to be set to encode content below..)
- if ( !$response->header('Content-type') ) {
- if ( exists( $app->config->{content_type} ) ) {
- $response->header(
- 'Content-Type' => $app->config->{content_type} );
- }
- else {
- $response->header(
- 'Content-Type' => $self->default_content_type );
- }
- }
if ( ref $content eq 'Dancer2::Core::Response' ) {
$response = $context->response($content);
}
- else {
- $response->content( defined $content ? $content : '' );
+ elsif ( defined $content ) {
+ # The response object has no back references to the content or app
+ # Update the default_content_type of the response if any value set in
+ # config so it can be applied when the response is encoded/returned.
+ if ( exists $app->config->{content_type}
+ && $app->config->{content_type} ) {
+ $response->default_content_type($app->config->{content_type});
+ }
+ $response->content($content);
$response->encode_content;
}
@@ -201,7 +190,7 @@ Dancer2::Core::Dispatcher - Class for dispatching request to the appropriate rou
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,12 +1,12 @@
package Dancer2::Core::Error;
# ABSTRACT: Class representing fatal errors
-$Dancer2::Core::Error::VERSION = '0.141000';
+$Dancer2::Core::Error::VERSION = '0.143000';
use Moo;
use Carp;
use Dancer2::Core::Types;
use Dancer2::Core::HTTP;
use Data::Dumper;
-use Dancer2::FileUtils 'path';
+use Dancer2::FileUtils qw/path open_file/;
@@ -102,10 +102,15 @@ sub default_error_page {
my $uri_base = $self->has_context ?
$self->context->request->uri_base : '';
+
+ my $message = $self->message;
+ if ( $self->show_errors && $self->exception) {
+ $message .= "\n" . $self->exception;
+ }
my $opts = {
title => $self->title,
charset => $self->charset,
- content => $self->message,
+ content => $message,
version => Dancer2->VERSION,
uri_base => $uri_base,
};
@@ -143,8 +148,10 @@ has status => (
has message => (
- is => 'ro',
- isa => Str,
+ is => 'ro',
+ isa => Str,
+ lazy => 1,
+ default => sub { '' },
);
sub full_message {
@@ -157,10 +164,19 @@ sub full_message {
has serializer => (
is => 'ro',
- isa => ConsumerOf ['Dancer2::Core::Role::Serializer'],
- predicate => 1,
+ isa => Maybe[ConsumerOf ['Dancer2::Core::Role::Serializer']],
+ builder => '_build_serializer',
);
+sub _build_serializer {
+ my ($self) = @_;
+
+ if ( $self->has_context && $self->context->has_app ) {
+ return $self->context->app->engine('serializer');
+ }
+ return;
+}
+
has session => (
is => 'ro',
isa => ConsumerOf ['Dancer2::Core::Role::Session'],
@@ -183,6 +199,14 @@ has exception => (
is => 'ro',
isa => Str,
predicate => 1,
+ coerce => sub {
+ # Until we properly support exception objects, we shouldn't barf on
+ # them because that hides the actual error, if object overloads "",
+ # which most exception objects do, this will result in a nicer string.
+ # other references will produce a meaningless error, but that is
+ # better than a meaningless stacktrace
+ return "$_[0]"
+ }
);
has response => (
@@ -200,7 +224,7 @@ has content_type => (
lazy => 1,
default => sub {
my $self = shift;
- $self->has_serializer
+ $self->serializer
? $self->serializer->content_type
: 'text/html'
},
@@ -213,7 +237,7 @@ has content => (
my $self = shift;
# Apply serializer
- if ( $self->has_serializer ) {
+ if ( $self->serializer ) {
my $content = {
message => $self->message,
title => $self->title,
@@ -238,7 +262,8 @@ has content => (
);
}
- if ( my $content = $self->static_page ) {
+ # It doesn't make sense to return a static page if show_errors is on
+ if ( !$self->show_errors && (my $content = $self->static_page) ) {
return $content;
}
@@ -257,8 +282,6 @@ sub throw {
$self->context->app->execute_hook( 'core.error.before', $self );
my $message = $self->content;
- $message .= "\n\n" . $self->exception
- if $self->show_errors && defined $self->exception;
$self->response->status( $self->status );
$self->response->content_type( $self->content_type );
@@ -275,8 +298,14 @@ sub throw {
sub backtrace {
my ($self) = @_;
- my $message =
- qq|<pre class="error">| . _html_encode( $self->message ) . "</pre>";
+ my $message = $self->exception ? $self->exception : $self->message;
+ $message =
+ qq|<pre class="error">| . _html_encode( $message ) . "</pre>";
+
+ if ( $self->exception && !ref($self->exception) ) {
+ $message .= qq|<pre class="error">|
+ . _html_encode($self->exception) . "</pre>";
+ }
# the default perl warning/error pattern
my ( $file, $line ) = ( $message =~ /at (\S+) line (\d+)/ );
@@ -374,7 +403,7 @@ sub environment {
. "</pre>";
my $settings =
qq|<div class="title">Settings</div><pre class="content">|
- . dumper( $self->app->settings )
+ . dumper( $self->context->app->settings )
. "</pre>";
my $source =
qq|<div class="title">Stack</div><pre class="content">|
@@ -437,6 +466,8 @@ sub _censor {
sub _html_encode {
my $value = shift;
+ return if !defined $value;
+
$value =~ s/&/&/g;
$value =~ s/</</g;
$value =~ s/>/>/g;
@@ -476,7 +507,7 @@ Dancer2::Core::Error - Class representing fatal errors
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Core::Factory;
# ABSTRACT: Instantiate components by type and name
-$Dancer2::Core::Factory::VERSION = '0.141000';
+$Dancer2::Core::Factory::VERSION = '0.143000';
use strict;
use warnings;
@@ -33,7 +33,7 @@ Dancer2::Core::Factory - Instantiate components by type and name
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,7 +1,7 @@
# ABSTRACT: helper for rendering HTTP status codes for Dancer2
package Dancer2::Core::HTTP;
-$Dancer2::Core::HTTP::VERSION = '0.141000';
+$Dancer2::Core::HTTP::VERSION = '0.143000';
use strict;
use warnings;
@@ -134,7 +134,7 @@ Dancer2::Core::HTTP - helper for rendering HTTP status codes for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 FUNCTIONS
@@ -1,6 +1,6 @@
package Dancer2::Core::Hook;
# ABSTRACT: Manipulate hooks with Dancer2
-$Dancer2::Core::Hook::VERSION = '0.141000';
+$Dancer2::Core::Hook::VERSION = '0.143000';
use Moo;
use Dancer2::Core::Types;
use Carp;
@@ -51,7 +51,7 @@ Dancer2::Core::Hook - Manipulate hooks with Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,7 +1,7 @@
# ABSTRACT: Class to ease manipulation of MIME types
package Dancer2::Core::MIME;
-$Dancer2::Core::MIME::VERSION = '0.141000';
+$Dancer2::Core::MIME::VERSION = '0.143000';
use Moo;
use MIME::Types;
@@ -88,7 +88,7 @@ Dancer2::Core::MIME - Class to ease manipulation of MIME types
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,5 +1,5 @@
package Dancer2::Core::Request::Upload;
-$Dancer2::Core::Request::Upload::VERSION = '0.141000';
+$Dancer2::Core::Request::Upload::VERSION = '0.143000';
# ABSTRACT: Class representing file upload requests
use Moo;
@@ -103,7 +103,7 @@ Dancer2::Core::Request::Upload - Class representing file upload requests
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Core::Request;
-$Dancer2::Core::Request::VERSION = '0.141000';
+$Dancer2::Core::Request::VERSION = '0.143000';
# ABSTRACT: Interface for accessing incoming requests
use Moo;
@@ -785,7 +785,7 @@ Dancer2::Core::Request - Interface for accessing incoming requests
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,7 +1,7 @@
# ABSTRACT: Response object for Dancer2
package Dancer2::Core::Response;
-$Dancer2::Core::Response::VERSION = '0.141000';
+$Dancer2::Core::Response::VERSION = '0.143000';
use Moo;
use Encode;
@@ -105,9 +105,18 @@ before content => sub {
};
+has default_content_type => (
+ is => 'rw',
+ isa => Str,
+ default => sub {'text/html'},
+);
+
+
sub encode_content {
my ($self) = @_;
return if $self->is_encoded;
+ # Apply default content type if none set.
+ $self->content_type or $self->content_type($self->default_content_type);
return if $self->content_type !~ /^text/;
# we don't want to encode an empty string, it will break the output
@@ -127,6 +136,10 @@ sub encode_content {
sub to_psgi {
my ($self) = @_;
+ # It is possible to have no content and/or no content type set
+ # e.g. if all routes 'pass'. Apply defaults here..
+ $self->content_type or $self->content_type($self->default_content_type);
+ $self->content('') if ! defined $self->content;
return [ $self->status, $self->headers_to_array, [ $self->content ], ];
}
@@ -210,7 +223,7 @@ Dancer2::Core::Response - Response object for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 ATTRIBUTES
@@ -234,6 +247,11 @@ response will try coerce it to a string via double quote interpolation.
Whenever the content changes, it recalculates and updates the Content-Length header,
unless the response has_passed.
+=head2 default_content_type
+
+Default mime type to use for the response Content-Type header
+if nothing was specified
+
=head1 METHODS
=head2 pass
@@ -1,6 +1,6 @@
# ABSTRACT: Config role for Dancer2 core objects
package Dancer2::Core::Role::ConfigReader;
-$Dancer2::Core::Role::ConfigReader::VERSION = '0.141000';
+$Dancer2::Core::Role::ConfigReader::VERSION = '0.143000';
use Moo::Role;
use File::Spec;
@@ -271,7 +271,7 @@ Dancer2::Core::Role::ConfigReader - Config role for Dancer2 core objects
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::DSL;
# ABSTRACT: Role for DSL
-$Dancer2::Core::Role::DSL::VERSION = '0.141000';
+$Dancer2::Core::Role::DSL::VERSION = '0.143000';
use Moo::Role;
use Dancer2::Core::Types;
use Carp 'croak';
@@ -104,7 +104,7 @@ Dancer2::Core::Role::DSL - Role for DSL
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::Engine;
# ABSTRACT: Role for engines
-$Dancer2::Core::Role::Engine::VERSION = '0.141000';
+$Dancer2::Core::Role::Engine::VERSION = '0.143000';
use Moo::Role;
use Dancer2::Core::Types;
@@ -34,7 +34,7 @@ Dancer2::Core::Role::Engine - Role for engines
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::Handler;
# ABSTRACT: Role for Handlers
-$Dancer2::Core::Role::Handler::VERSION = '0.141000';
+$Dancer2::Core::Role::Handler::VERSION = '0.143000';
use Moo::Role;
use Dancer2::Core::Types;
@@ -25,7 +25,7 @@ Dancer2::Core::Role::Handler - Role for Handlers
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 ATTRIBUTES
@@ -1,7 +1,7 @@
# ABSTRACT: Role for handling headers
package Dancer2::Core::Role::Headers;
-$Dancer2::Core::Role::Headers::VERSION = '0.141000';
+$Dancer2::Core::Role::Headers::VERSION = '0.143000';
use Moo::Role;
use Dancer2::Core::Types;
@@ -80,7 +80,7 @@ Dancer2::Core::Role::Headers - Role for handling headers
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::Hookable;
# ABSTRACT: Role for hookable objects
-$Dancer2::Core::Role::Hookable::VERSION = '0.141000';
+$Dancer2::Core::Role::Hookable::VERSION = '0.143000';
use Moo::Role;
use Dancer2::Core;
use Dancer2::Core::Types;
@@ -154,7 +154,7 @@ Dancer2::Core::Role::Hookable - Role for hookable objects
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::Logger;
# ABSTRACT: Role for logger engines
-$Dancer2::Core::Role::Logger::VERSION = '0.141000';
+$Dancer2::Core::Role::Logger::VERSION = '0.143000';
use Dancer2::Core::Types;
use Moo::Role;
@@ -175,7 +175,7 @@ Dancer2::Core::Role::Logger - Role for logger engines
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::Serializer;
# ABSTRACT: Role for Serializer engines
-$Dancer2::Core::Role::Serializer::VERSION = '0.141000';
+$Dancer2::Core::Role::Serializer::VERSION = '0.143000';
use Dancer2::Core::Types;
use Moo::Role;
@@ -76,7 +76,7 @@ Dancer2::Core::Role::Serializer - Role for Serializer engines
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Core::Role::SessionFactory::File;
-$Dancer2::Core::Role::SessionFactory::File::VERSION = '0.141000';
+$Dancer2::Core::Role::SessionFactory::File::VERSION = '0.143000';
#ABSTRACT: Role for file-based session factories
@@ -114,7 +114,7 @@ Dancer2::Core::Role::SessionFactory::File - Role for file-based session factorie
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Core::Role::SessionFactory;
-$Dancer2::Core::Role::SessionFactory::VERSION = '0.141000';
+$Dancer2::Core::Role::SessionFactory::VERSION = '0.143000';
#ABSTRACT: Role for session factories
@@ -272,7 +272,7 @@ Dancer2::Core::Role::SessionFactory - Role for session factories
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Core::Role::StandardResponses;
# ABSTRACT: Role to provide commonly used responses
-$Dancer2::Core::Role::StandardResponses::VERSION = '0.141000';
+$Dancer2::Core::Role::StandardResponses::VERSION = '0.143000';
use Moo::Role;
@@ -41,7 +41,7 @@ Dancer2::Core::Role::StandardResponses - Role to provide commonly used responses
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 METHODS
@@ -1,7 +1,7 @@
# ABSTRACT: Role for template engines
package Dancer2::Core::Role::Template;
-$Dancer2::Core::Role::Template::VERSION = '0.141000';
+$Dancer2::Core::Role::Template::VERSION = '0.143000';
use Dancer2::Core::Types;
use Dancer2::FileUtils qw'path';
use Carp 'croak';
@@ -199,7 +199,7 @@ Dancer2::Core::Role::Template - Role for template engines
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,7 +1,7 @@
# ABSTRACT: Dancer2's route handler
package Dancer2::Core::Route;
-$Dancer2::Core::Route::VERSION = '0.141000';
+$Dancer2::Core::Route::VERSION = '0.143000';
use strict;
use warnings;
@@ -233,7 +233,7 @@ Dancer2::Core::Route - Dancer2's route handler
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 ATTRIBUTES
@@ -1,6 +1,6 @@
package Dancer2::Core::Runner;
# ABSTRACT: Top-layer class to start a dancer app
-$Dancer2::Core::Runner::VERSION = '0.141000';
+$Dancer2::Core::Runner::VERSION = '0.143000';
use Moo;
use Dancer2::Core::MIME;
use Dancer2::Core::Types;
@@ -291,7 +291,7 @@ Dancer2::Core::Runner - Top-layer class to start a dancer app
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,5 +1,5 @@
package Dancer2::Core::Session;
-$Dancer2::Core::Session::VERSION = '0.141000';
+$Dancer2::Core::Session::VERSION = '0.143000';
#ABSTRACT: class to represent any session object
@@ -77,7 +77,7 @@ Dancer2::Core::Session - class to represent any session object
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Core::Time;
-$Dancer2::Core::Time::VERSION = '0.141000';
+$Dancer2::Core::Time::VERSION = '0.143000';
#ABSTRACT: class to handle common helpers for time manipulations
@@ -141,7 +141,7 @@ Dancer2::Core::Time - class to handle common helpers for time manipulations
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,5 +1,5 @@
package Dancer2::Core::Types;
-$Dancer2::Core::Types::VERSION = '0.141000';
+$Dancer2::Core::Types::VERSION = '0.143000';
# ABSTRACT: Moo types for Dancer2 core.
use strict;
@@ -150,7 +150,7 @@ Dancer2::Core::Types - Moo types for Dancer2 core.
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,7 +1,7 @@
# ABSTRACT: Core libraries for Dancer2 2.0
package Dancer2::Core;
-$Dancer2::Core::VERSION = '0.141000';
+$Dancer2::Core::VERSION = '0.143000';
use strict;
use warnings;
@@ -29,7 +29,7 @@ Dancer2::Core - Core libraries for Dancer2 2.0
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 FUNCTIONS
@@ -1,7 +1,7 @@
# ABSTRACT: File utility helpers
package Dancer2::FileUtils;
-$Dancer2::FileUtils::VERSION = '0.141000';
+$Dancer2::FileUtils::VERSION = '0.143000';
use strict;
use warnings;
@@ -111,7 +111,7 @@ Dancer2::FileUtils - File utility helpers
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Handler::AutoPage;
# ABSTRACT: Class for handling the AutoPage feature
-$Dancer2::Handler::AutoPage::VERSION = '0.141000';
+$Dancer2::Handler::AutoPage::VERSION = '0.143000';
use Moo;
use Carp 'croak';
use Dancer2::Core::Types;
@@ -61,7 +61,7 @@ Dancer2::Handler::AutoPage - Class for handling the AutoPage feature
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Handler::File;
# ABSTRACT: class for handling file content rendering
-$Dancer2::Handler::File::VERSION = '0.141000';
+$Dancer2::Handler::File::VERSION = '0.143000';
use Carp 'croak';
use Moo;
use HTTP::Date;
@@ -114,14 +114,17 @@ sub code {
my @stat = stat $file_path;
- $ctx->response->header( 'Content-Type', $content_type );
+ $ctx->response->header('Content-Type')
+ or $ctx->response->header( 'Content-Type', $content_type );
- $ctx->response->header( 'Content-Length', $stat[7] );
+ $ctx->response->header('Content-Length')
+ or $ctx->response->header( 'Content-Length', $stat[7] );
- $ctx->response->header(
+ $ctx->response->header('Last-Modified')
+ or $ctx->response->header(
'Last-Modified',
HTTP::Date::time2str( $stat[9] )
- );
+ );
$ctx->response->content($content);
$ctx->response->is_encoded(1); # bytes are already encoded
@@ -142,7 +145,7 @@ Dancer2::Handler::File - class for handling file content rendering
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 AUTHOR
@@ -1,6 +1,6 @@
package Dancer2::Logger::Capture::Trap;
# ABSTRACT: a place to store captured Dancer2 logs
-$Dancer2::Logger::Capture::Trap::VERSION = '0.141000';
+$Dancer2::Logger::Capture::Trap::VERSION = '0.143000';
use Moo;
use Dancer2::Core::Types;
@@ -35,7 +35,7 @@ Dancer2::Logger::Capture::Trap - a place to store captured Dancer2 logs
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Logger::Capture;
# ABSTRACT: Capture dancer logs
-$Dancer2::Logger::Capture::VERSION = '0.141000';
+$Dancer2::Logger::Capture::VERSION = '0.143000';
use Moo;
use Dancer2::Logger::Capture::Trap;
@@ -34,7 +34,7 @@ Dancer2::Logger::Capture - Capture dancer logs
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Logger::Console;
# ABSTRACT: Console logger
-$Dancer2::Logger::Console::VERSION = '0.141000';
+$Dancer2::Logger::Console::VERSION = '0.143000';
use Moo;
with 'Dancer2::Core::Role::Logger';
@@ -22,7 +22,7 @@ Dancer2::Logger::Console - Console logger
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Logger::Diag;
# ABSTRACT: Test::More diag() logging engine for Dancer2
-$Dancer2::Logger::Diag::VERSION = '0.141000';
+$Dancer2::Logger::Diag::VERSION = '0.143000';
use Moo;
use Test::More;
@@ -26,7 +26,7 @@ Dancer2::Logger::Diag - Test::More diag() logging engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Logger::File;
# ABSTRACT: file-based logging engine for Dancer2
-$Dancer2::Logger::File::VERSION = '0.141000';
+$Dancer2::Logger::File::VERSION = '0.143000';
use Carp 'carp';
use Moo;
use Dancer2::Core::Types;
@@ -112,7 +112,7 @@ Dancer2::Logger::File - file-based logging engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Logger::Note;
# ABSTRACT: Test::More note() logging engine for Dancer2
-$Dancer2::Logger::Note::VERSION = '0.141000';
+$Dancer2::Logger::Note::VERSION = '0.143000';
use Moo;
use Test::More;
@@ -25,7 +25,7 @@ Dancer2::Logger::Note - Test::More note() logging engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Logger::Null;
# ABSTRACT: Blackhole-like silent logging engine for Dancer2
-$Dancer2::Logger::Null::VERSION = '0.141000';
+$Dancer2::Logger::Null::VERSION = '0.143000';
use Moo;
with 'Dancer2::Core::Role::Logger';
@@ -19,7 +19,7 @@ Dancer2::Logger::Null - Blackhole-like silent logging engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
# ABSTRACT: A gentle introduction to Dancer2
package Dancer2::Manual;
-$Dancer2::Manual::VERSION = '0.141000';
+$Dancer2::Manual::VERSION = '0.143000';
__END__
=pod
@@ -11,7 +11,7 @@ Dancer2::Manual - A gentle introduction to Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,7 +1,7 @@
# ABSTRACT: a plugin for adding Ajax route handlers
package Dancer2::Plugin::Ajax;
-$Dancer2::Plugin::Ajax::VERSION = '0.141000';
+$Dancer2::Plugin::Ajax::VERSION = '0.143000';
use strict;
use warnings;
@@ -62,7 +62,7 @@ Dancer2::Plugin::Ajax - a plugin for adding Ajax route handlers
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,5 +1,5 @@
package Dancer2::Plugin;
-$Dancer2::Plugin::VERSION = '0.141000';
+$Dancer2::Plugin::VERSION = '0.143000';
# ABSTRACT: Extending Dancer2's DSL with plugins
@@ -258,7 +258,7 @@ Dancer2::Plugin - Extending Dancer2's DSL with plugins
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Plugins;
# ABSTRACT: Recommended Dancer2 plugins
-$Dancer2::Plugins::VERSION = '0.141000';
+$Dancer2::Plugins::VERSION = '0.143000';
__END__
=pod
@@ -11,7 +11,7 @@ Dancer2::Plugins - Recommended Dancer2 plugins
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,7 +1,7 @@
# ABSTRACT: Serializer for handling Dumper data
package Dancer2::Serializer::Dumper;
-$Dancer2::Serializer::Dumper::VERSION = '0.141000';
+$Dancer2::Serializer::Dumper::VERSION = '0.143000';
use Moo;
use Carp 'croak';
use Data::Dumper;
@@ -53,7 +53,7 @@ Dancer2::Serializer::Dumper - Serializer for handling Dumper data
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Serializer::JSON;
# ABSTRACT: Serializer for handling JSON data
-$Dancer2::Serializer::JSON::VERSION = '0.141000';
+$Dancer2::Serializer::JSON::VERSION = '0.143000';
use Moo;
use JSON ();
@@ -25,15 +25,12 @@ sub loaded {1}
sub serialize {
my ( $self, $entity, $options ) = @_;
- # Why doesn't $self->config have this?
my $config = $self->config;
- if ( $config->{allow_blessed} && !defined $options->{allow_blessed} ) {
- $options->{allow_blessed} = $config->{allow_blessed};
- }
- if ( $config->{convert_blessed} ) {
- $options->{convert_blessed} = $config->{convert_blessed};
+ foreach (keys %$config) {
+ $options->{$_} = $config->{$_} unless exists $options->{$_};
}
+
$options->{utf8} = 1 if !defined $options->{utf8};
JSON::to_json( $entity, $options );
@@ -58,7 +55,7 @@ Dancer2::Serializer::JSON - Serializer for handling JSON data
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Serializer::Mutable;
# ABSTRACT: Serialize and deserialize content based on HTTP header
-$Dancer2::Serializer::Mutable::VERSION = '0.141000';
+$Dancer2::Serializer::Mutable::VERSION = '0.143000';
use Moo;
use Carp 'croak';
use Encode;
@@ -107,7 +107,7 @@ Dancer2::Serializer::Mutable - Serialize and deserialize content based on HTTP h
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Serializer::YAML;
# ABSTRACT: Serializer for handling YAML data
-$Dancer2::Serializer::YAML::VERSION = '0.141000';
+$Dancer2::Serializer::YAML::VERSION = '0.143000';
use Moo;
use Carp 'croak';
use Encode;
@@ -49,7 +49,7 @@ Dancer2::Serializer::YAML - Serializer for handling YAML data
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Session::Simple;
# ABSTRACT: in-memory session backend for Dancer2
-$Dancer2::Session::Simple::VERSION = '0.141000';
+$Dancer2::Session::Simple::VERSION = '0.143000';
use Moo;
use Dancer2::Core::Types;
use Carp;
@@ -48,7 +48,7 @@ Dancer2::Session::Simple - in-memory session backend for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Session::YAML;
-$Dancer2::Session::YAML::VERSION = '0.141000';
+$Dancer2::Session::YAML::VERSION = '0.143000';
# ABSTRACT: YAML-file-based session backend for Dancer2
use Moo;
@@ -37,7 +37,7 @@ Dancer2::Session::YAML - YAML-file-based session backend for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,5 +1,5 @@
package Dancer2::Template::Implementation::ForkedTiny;
-$Dancer2::Template::Implementation::ForkedTiny::VERSION = '0.141000';
+$Dancer2::Template::Implementation::ForkedTiny::VERSION = '0.143000';
# ABSTRACT: Dancer2 own implementation of Template::Tiny
use 5.00503;
@@ -227,7 +227,7 @@ Dancer2::Template::Implementation::ForkedTiny - Dancer2 own implementation of Te
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Template::Simple;
# ABSTRACT: Pure Perl 5 template engine for Dancer2
-$Dancer2::Template::Simple::VERSION = '0.141000';
+$Dancer2::Template::Simple::VERSION = '0.143000';
use strict;
use warnings;
use Moo;
@@ -154,7 +154,7 @@ Dancer2::Template::Simple - Pure Perl 5 template engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,7 +1,7 @@
# ABSTRACT: Template toolkit engine for Dancer2
package Dancer2::Template::TemplateToolkit;
-$Dancer2::Template::TemplateToolkit::VERSION = '0.141000';
+$Dancer2::Template::TemplateToolkit::VERSION = '0.143000';
use strict;
use warnings;
use Carp qw/croak/;
@@ -61,7 +61,7 @@ Dancer2::Template::TemplateToolkit - Template toolkit engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Template::Tiny;
# ABSTRACT: Template::Tiny engine for Dancer2
-$Dancer2::Template::Tiny::VERSION = '0.141000';
+$Dancer2::Template::Tiny::VERSION = '0.143000';
use Moo;
use Carp qw/croak/;
use Dancer2::Core::Types;
@@ -48,7 +48,7 @@ Dancer2::Template::Tiny - Template::Tiny engine for Dancer2
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -1,6 +1,6 @@
package Dancer2::Test;
# ABSTRACT: Useful routines for testing Dancer2 apps
-$Dancer2::Test::VERSION = '0.141000';
+$Dancer2::Test::VERSION = '0.143000';
use strict;
use warnings;
@@ -619,7 +619,7 @@ Dancer2::Test - Useful routines for testing Dancer2 apps
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -1,6 +1,6 @@
package Dancer2::Tutorial;
# ABSTRACT: An example to get you dancing
-$Dancer2::Tutorial::VERSION = '0.141000';
+$Dancer2::Tutorial::VERSION = '0.143000';
__END__
=pod
@@ -11,7 +11,7 @@ Dancer2::Tutorial - An example to get you dancing
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 What is Dancer2?
@@ -1,6 +1,6 @@
package Dancer2;
# ABSTRACT: Lightweight yet powerful web application framework
-$Dancer2::VERSION = '0.141000';
+$Dancer2::VERSION = '0.143000';
use strict;
use warnings;
use Class::Load 'load_class';
@@ -14,11 +14,12 @@ our $AUTHORITY = 'SUKRIA';
# set version in dist.ini now
# but we still need a basic version for
# the tests
-$Dancer2::VERSION ||= '0.140001'; # 2.14.1
+$Dancer2::VERSION ||= '0.143000'; # 2.14.3
our $runner;
-sub runner {$runner}
+sub runner {$runner}
+sub psgi_app { __PACKAGE__->runner->psgi_app }
sub import {
my ( $class, @args ) = @_;
@@ -104,7 +105,7 @@ Dancer2 - Lightweight yet powerful web application framework
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 DESCRIPTION
@@ -244,6 +245,7 @@ Returns the current runner. It is of type L<Dancer2::Core::Runner>.
Grzegorz Rożniecki
Hobbestigrou
Ivan Bessarabov
+ Jakob Voss
James Aitken
Jason A. Crome
Jean Stebens
@@ -31,7 +31,7 @@ dancer2 - Dancer2 command line interface
=head1 VERSION
-version 0.141000
+version 0.143000
=head1 SYNOPSIS
@@ -15,6 +15,8 @@ log: "core"
warnings: 1
# should Dancer2 show a stacktrace when an error is caught?
+# if set to yes, public/500.html will be ignored and either
+# views/500.tt or a default error template will be used.
show_errors: 1
# print the banner
@@ -1,5 +1,5 @@
-use Test::More tests => 1;
use strict;
use warnings;
+use Test::More tests => 1;
use_ok '[% appname %]';
@@ -1,10 +1,17 @@
-use Test::More tests => 2;
use strict;
use warnings;
-# the order is important
use [% appname %];
-use Dancer2::Test apps => ['[% appname %]'];
+use Test::More tests => 2;
+use Plack::Test;
+use HTTP::Request::Common;
+
+my $app = Dancer2->psgi_app;
+is( ref $app, 'CODE', 'Got app' );
+
+test_psgi $app, sub {
+ my $cb = shift;
+
+ ok( $cb->( GET '/' )->is_success, '[GET /] successful' );
+};
-route_exists [GET => '/'], 'a route handler is defined for /';
-response_status_is ['GET' => '/'], 200, 'response status is 200 for /';
@@ -10,6 +10,8 @@ use Dancer2::Core::Response;
use Dancer2::Core::Request;
use Dancer2::Core::Error;
+use JSON (); # Error serialization
+
my $env = {
'psgi.url_scheme' => 'http',
REQUEST_METHOD => 'GET',
@@ -36,7 +38,7 @@ subtest 'basic defaults of Error object' => sub {
my $e = Dancer2::Core::Error->new( context => $c, );
is $e->status, 500, 'code';
is $e->title, 'Error 500 - Internal Server Error', 'title';
- is $e->message, undef, 'message';
+ is $e->message, '', 'message';
like $e->content, qr!http://localhost:5000/foo/css!,
"error content contains css path relative to uri_base";
};
@@ -131,4 +133,64 @@ subtest 'Error with show_errors: 1' => sub {
like $err->content => qr/our exception/;
};
+subtest 'App dies with serialized error' => sub {
+ {
+ package AppDies;
+ use Dancer2;
+ set serializer => 'JSON';
+
+ get '/die' => sub {
+ die "oh no\n"; # I should serialize
+ };
+ }
+
+ my $app = Dancer2->runner->psgi_app;
+ isa_ok( $app, 'CODE', 'Got app' );
+
+ test_psgi $app, sub {
+ my $cb = shift;
+ my $r = $cb->( GET '/die' );
+
+ is( $r->code, 500, '/die returns 500' );
+
+ my $out = eval { JSON->new->utf8(0)->decode($r->decoded_content) };
+ ok(!$@, 'JSON decoding serializer error produces no errors');
+ isa_ok($out, 'HASH', 'Error deserializes to a hash');
+ like($out->{exception}, qr/^oh no/, 'Get expected error message');
+ };
+};
+
+subtest 'Error with exception object' => sub {
+ local $@;
+ eval { MyTestException->throw('a test exception object') };
+ my $err = Dancer2::Core::Error->new(
+ context => $c,
+ exception => $@,
+ show_errors => 1,
+ )->throw;
+
+ like $err->content, qr/a test exception object/, 'Error content contains exception message';
+};
+
done_testing;
+
+
+{ # Simple test exception class
+ package MyTestException;
+
+ use overload '""' => \&as_str;
+
+ sub new {
+ return bless {};
+ }
+
+ sub throw {
+ my ( $class, $error ) = @_;
+ my $self = ref($class) ? $class : $class->new;
+ $self->{error} = $error;
+
+ die $self;
+ }
+
+ sub as_str { return $_[0]->{error} }
+}
@@ -4,6 +4,7 @@ use warnings;
use Test::More;
use Plack::Test;
use HTTP::Request::Common;
+use File::Temp;
{
package StaticContent;
@@ -23,6 +24,14 @@ use HTTP::Request::Common;
return "send_file returns; this content is ignored";
};
};
+
+ get '/check_content_type' => sub {
+ my $temp = File::Temp->new();
+ print $temp "hello";
+ close $temp;
+ send_file($temp->filename, content_type => 'image/png',
+ system_path => 1);
+ };
}
my $app = Dancer2->runner->psgi_app;
@@ -49,7 +58,21 @@ test_psgi $app, sub {
my $r = $cb->( GET '/some/image' );
is( $r->code, 200, 'send_file sets the status to 200' );
- unlike( $r->content, qr/send_file returns/, "send_file returns immediately with content");
+ unlike( $r->content, qr/send_file returns/,
+ "send_file returns immediately with content");
+ is( $r->header( 'Content-Type' ), 'image/png',
+ 'correct content_type in response' );
+ };
+};
+
+test_psgi $app, sub {
+ my $cb = shift;
+
+ subtest 'send_file returns correct content type' => sub {
+ my $r = $cb->( GET '/check_content_type' );
+
+ ok($r->is_success, 'send_file returns success');
+ is($r->content_type, 'image/png', 'send_file returns correct content_type');
};
};
@@ -2,32 +2,69 @@ use strict;
use warnings;
use Test::More;
+use Plack::Test;
+use HTTP::Request::Common;
-require Dancer2::Serializer::JSON;
+use Dancer2::Serializer::JSON;
+
+# config
+{
+ package MyApp;
+
+ use Dancer2;
+ our $entity;
+
+ set engines => {
+ serializer => {
+ JSON => {
+ pretty => 1,
+ }
+ }
+ };
+ set serializer => 'JSON';
+
+ get '/serialize' => sub {
+ return $entity;
+ };
+}
my @tests = (
{ entity => { a => 1, b => 2, },
options => { pretty => 1 },
+ name => "basic hash",
},
- { entity =>
+ { entity =>
{ c => [ { d => 3, e => { f => 4, g => 'word', } } ], h => 6 },
options => { pretty => 1 },
+ name => "nested",
}
);
+my $app = Dancer2->runner->psgi_app;
+
for my $test (@tests) {
+ my $expected = JSON::to_json( $test->{entity}, $test->{options} );
+
+ # Helpers pass options
my $actual =
Dancer2::Serializer::JSON::to_json( $test->{entity}, $test->{options} );
- my $expected = JSON::to_json( $test->{entity}, $test->{options} );
- is( $actual, $expected );
-}
+ is( $actual, $expected, "to_json: $test->{name}" );
-use Dancer2::Core::Response;
-my $resp = Dancer2::Core::Response->new(
- content => '---',
- serializer => Dancer2::Serializer::JSON->new(),
-);
+ # Options from config
+ my $serializer = Dancer2::Serializer::JSON->new(config => $test->{options});
+ my $output = $serializer->serialize( $test->{entity} );
+ is( $output, $expected, "serialize: $test->{name}" );
+
+ $MyApp::entity = $test->{entity};
+ test_psgi $app, sub {
+ my $cb = shift;
+
+ my $res = $cb->( GET '/serialize' );
+ is($res->content, $expected,
+ "serialized content in response: $test->{name}");
+ };
+
+}
-$resp->serialize();
done_testing();
@@ -0,0 +1,2 @@
+---
+name: damian
@@ -0,0 +1,2 @@
+---
+name: damian