Permalink
Browse files

Merge branch 'release/1.3014_01'

  • Loading branch information...
2 parents bd7be1a + ace6ff8 commit efbfd6b17b76384cc6ea13b6a1106674651ac4f4 @xsawyerx xsawyerx committed Mar 10, 2011
View
@@ -14,3 +14,4 @@ logs
TestApp
t/sessions/
tags
+MYMETA.yml
View
40 CHANGES
@@ -1,3 +1,43 @@
+{{$NEXT}}
+
+1.3014_01 10.03.2011
+
+ [ BUG FIXES ]
+ * GH #373: Display valid path to the main app file in the welcome screen.
+ (Franck Cuny)
+ * GH #152, GH #170, GH #362: Log dir is not created when logger is not set
+ to 'file', and setting log_path works as expected.
+ (Franck Cuny)
+ * GH #308: Use request's uri_base.
+ (Sawyer X)
+ * GH #378: Some routes with prefix where wrongly matched.
+ (Franck Cuny)
+
+ [ ENHANCEMENTS ]
+ * GH #351: Explicitly exclude some keywords when important Dancer's syntax,
+ add modes that also excludes some keywords (:moose, :tests).
+ (Sawyer X, Naveed Massjouni, Michael G. Schwern, Franck Cuny)
+ * All logging options accept any number of variables.
+ (Sawyer X)
+ * GH #297: All logging options can automatically serialize references.
+ (Sawyer X)
+ * Add Dancer::Logger::Capture to capture and read log messages during
+ testing.
+ (Michael G. Schwern)
+ * Dancer::Cookie make secure (https only) cookies. It also adds the
+ "session_secure" setting instructing sessions to use secure cookies.
+ (Michael G. Schwern)
+ * Adding uri_base to Request.pm.
+ (Sawyer X)
+ * Make Dancer::Test use the capture logger
+ (Michael G. Schwern)
+
+ [ DOCUMENTATION ]
+ * Dancing on command line.
+ (Maurice Mengel)
+ * Improve Dancer::Cookbook.
+ (Maurice Mengel)
+
1.3014 04.03.2011
[ BUG FIXES ]
View
@@ -32,6 +32,8 @@ lib/Dancer/HTTP.pm
lib/Dancer/Introduction.pod
lib/Dancer/Logger.pm
lib/Dancer/Logger/Abstract.pm
+lib/Dancer/Logger/Capture.pm
+lib/Dancer/Logger/Capture/Trap.pm
lib/Dancer/Logger/Console.pm
lib/Dancer/Logger/Diag.pm
lib/Dancer/Logger/File.pm
@@ -83,6 +85,8 @@ t/00_base/003_syntax.t
t/00_base/004_args.t
t/00_base/005_module_loader.t
t/00_base/007_load_syntax.t
+t/00_base/008_export.t
+t/00_base/009_syntax_export.t
t/00_base/06_dancer_object.t
t/00_base/08_pod_coverage_dancer.t
t/00_base/09_load_app.t
@@ -123,6 +127,7 @@ t/02_request/13_ajax.t
t/02_request/14_uploads.t
t/02_request/15_headers.t
t/02_request/16_delete.t
+t/02_request/17_uri_base.t
t/03_route_handler/000_create_fake_env.t
t/03_route_handler/00_http_methods.t
t/03_route_handler/00_route_object.t
@@ -202,10 +207,12 @@ t/08_session/07_session_expires.t
t/08_session/08_simple.t
t/08_session/09_session.t
t/08_session/10_filter.t
+t/08_session/11_session_secure.t
t/09_cookies/000_create_fake_env.t
t/09_cookies/01_use.t
t/09_cookies/02_cookie_object.t
t/09_cookies/03_persistence.t
+t/09_cookies/04_secure.t
t/09_cookies/05_api.t
t/10_template/000_create_fake_env.t
t/10_template/01_factory.t
@@ -224,6 +231,8 @@ t/11_logger/04_console.t
t/11_logger/05_format.t
t/11_logger/06_null.t
t/11_logger/07_diag.t
+t/11_logger/08_serialize.t
+t/11_logger/09_capture.t
t/12_response/000_create_fake_env.t
t/12_response/01_CRLF_injection.t
t/12_response/02_headers.t
View
@@ -5,10 +5,8 @@ use warnings;
use Carp;
use Cwd 'realpath';
-use vars qw($VERSION $AUTHORITY @EXPORT);
-
-$VERSION = '1.3014';
-$AUTHORITY = 'SUKRIA';
+our $VERSION = '1.3014_01';
+our $AUTHORITY = 'SUKRIA';
use Dancer::App;
use Dancer::Config;
@@ -32,7 +30,7 @@ use File::Spec;
use base 'Exporter';
-@EXPORT = qw(
+our @EXPORT = qw(
after
any
before
@@ -162,18 +160,34 @@ sub warning { goto &Dancer::Logger::warning }
# When importing the package, strict and warnings pragma are loaded,
# and the appdir detection is performed.
sub import {
- my ($class, $symbol) = @_;
+ my ($class, @args) = @_;
my ($package, $script) = caller;
strict->import;
utf8->import;
- $class->export_to_level(1, $class, @EXPORT);
- # if :syntax option exists, don't change settings
- if ($symbol && $symbol eq ':syntax') {
- return;
+ my @final_args;
+ my $syntax_only = 0;
+ foreach (@args) {
+ if ( $_ eq ':moose' ) {
+ push @final_args, '!before', '!after';
+ }
+ elsif ( $_ eq ':tests' ) {
+ push @final_args, '!pass';
+ }
+ elsif ( $_ eq ':syntax' ) {
+ $syntax_only = 1;
+ }
+ else {
+ push @final_args, $_;
+ }
}
+ $class->export_to_level(1, $class, @final_args);
+
+ # if :syntax option exists, don't change settings
+ return if $syntax_only;
+
Dancer::GetOpt->process_args();
_init_script_dir($script);
@@ -252,8 +266,6 @@ sub _init_script_dir {
Dancer::setting(views => $ENV{DANCER_VIEWS}
|| Dancer::FileUtils::path_no_verify($appdir, 'views'));
- Dancer::setting(logger => 'file');
-
my ($res, $error) = Dancer::ModuleLoader->use_lib(Dancer::FileUtils::path_no_verify($appdir, 'lib'));
$res or croak "unable to set libdir : $error";
}
@@ -377,7 +389,53 @@ involving Dancer and Plack, see L<Dancer::Deployment>.
You can find out more about the many useful plugins available for Dancer in
L<Dancer::Plugins>.
-=head1 METHODS
+
+=head1 EXPORTS
+
+By default, C<use Dancer> exports all the functions below plus sets up
+your app. You can control the exporting through the normal
+L<Exporter> means. For example:
+
+ # Just export the route controllers
+ use Dancer qw(before after get post);
+
+ # Export everything but pass to avoid clashing with Test::More
+ use Test::More;
+ use Dancer qw(!pass);
+
+There are also some special tags to control exports and behavior.
+
+=head2 :moose
+
+This will export everything except those functions which clash with
+Moose. Currently that is L<after> and L<before>.
+
+=head2 :syntax
+
+This tells Dancer to just export symbols and not set up your app.
+This is most useful for writing Dancer code outside of your main route
+handler.
+
+=head2 :tests
+
+This will export everything except those functions which clash with
+commonly used testing modules. Currently that is L<pass>.
+
+These can be combined. For example, while testing...
+
+ use Test::More;
+ use Dancer qw(:syntax :tests);
+
+ # Test::Most also exports "set" and "any"
+ use Test::Most;
+ use Dancer qw(:syntax :tests !set !any);
+
+ # Alternatively, if you want to use Dancer's set and any...
+ use Test::Most qw(!set !any);
+ use Dancer qw(:syntax :tests);
+
+
+=head1 FUNCTIONS
=head2 after
View
@@ -209,8 +209,9 @@ sub load_default_settings {
$SETTINGS->{warnings} ||= $ENV{DANCER_WARNINGS} || 0;
$SETTINGS->{auto_reload} ||= $ENV{DANCER_AUTO_RELOAD} || 0;
$SETTINGS->{traces} ||= $ENV{DANCER_TRACES} || 0;
- $SETTINGS->{environment}
- ||= $ENV{DANCER_ENVIRONMENT}
+ $SETTINGS->{logger} ||= $ENV{DANCER_LOGGER} || 'file';
+ $SETTINGS->{environment} ||=
+ $ENV{DANCER_ENVIRONMENT}
|| $ENV{PLACK_ENV}
|| 'development';
Oops, something went wrong.

0 comments on commit efbfd6b

Please sign in to comment.