Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:sukria/Dancer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Sukrieh committed Feb 5, 2010
2 parents 3e7396c + 6d28e00 commit 30a7231
Show file tree
Hide file tree
Showing 49 changed files with 1,516 additions and 1,994 deletions.
2 changes: 1 addition & 1 deletion .perltidyrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-i=4 # Indent level is 4 cols
-ci=4 # Continuation indent is 4 cols

-st # Output to STDOUT
-b
-se # Errors to STDERR
-vt=2 # Maximal vertical tightness
-cti=0 # No extra indentation for closing brackets
Expand Down
15 changes: 14 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
Dancer 1.123~
Dancer 1.130
* Fix a memory leak that could occur between two
requests under mod_perl (Thanks to Nicolas Rennert for
the report and diagnosis).
* remove all optional modules from the core, they are now
shipped as separate CPAN distributions:
- Dancer::Template::MicroTemplate
- Dancer::Session::Cookie
- Dancer::Session::Memcached
- Dancer::Logger::LogHandler
- Dancer::Logger::Syslog
* support for the `header' keyword in Dancer's syntax.
The user is now able to alter response-headers in route
handlers.
* support for `prefix' keyword in Dancer's syntax.
A prefix can be set by the user before defining routes handlers.
All route defined then will be automatically prefixed accordingly.

Dancer 1.122

Expand Down
23 changes: 12 additions & 11 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.gitignore
.perltidyrc
AUTHORS
CHANGES
lib/Dancer.pm
lib/Dancer/Config.pm
lib/Dancer/Cookie.pm
lib/Dancer/Cookies.pm
Expand All @@ -12,30 +15,25 @@ lib/Dancer/Handler/PSGI.pm
lib/Dancer/Handler/Standalone.pm
lib/Dancer/Helpers.pm
lib/Dancer/HTTP.pm
lib/Dancer/Logger.pm
lib/Dancer/Logger/Abstract.pm
lib/Dancer/Logger/File.pm
lib/Dancer/Logger.pm
lib/Dancer/Logger/Syslog.pm
lib/Dancer/ModuleLoader.pm
lib/Dancer/Object.pm
lib/Dancer.pm
lib/Dancer/Renderer.pm
lib/Dancer/Request.pm
lib/Dancer/Response.pm
lib/Dancer/Route.pm
lib/Dancer/Session/Abstract.pm
lib/Dancer/Session/Cookie.pm
lib/Dancer/Session/Memcached.pm
lib/Dancer/Session.pm
lib/Dancer/Session/Abstract.pm
lib/Dancer/Session/YAML.pm
lib/Dancer/SharedData.pm
lib/Dancer/Template/Abstract.pm
lib/Dancer/Template.pm
lib/Dancer/Template/Abstract.pm
lib/Dancer/Template/Simple.pm
lib/Dancer/Template/TemplateToolkit.pm
Makefile.PL
MANIFEST
.perltidyrc
README
ROADMAP
script/dancer
Expand All @@ -44,6 +42,7 @@ t/00_base/002_strict_and_warnings.t
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/06_dancer_object.t
t/01_config/01_settings.t
t/01_config/02_mime_type.t
Expand Down Expand Up @@ -72,6 +71,8 @@ t/03_route_handler/10_merge_registries.t
t/03_route_handler/11_redirect.t
t/03_route_handler/12_response.t
t/03_route_handler/13_any_route_handler.t
t/03_route_handler/14_options.t
t/03_route_handler/15_prefix.t
t/04_static_file/001_base.t
t/04_static_file/002_mime_types.t
t/04_static_file/03_get_mime_type.t
Expand Down Expand Up @@ -103,7 +104,6 @@ t/08_session/02_dependency_check.t
t/08_session/03_http_requests.t
t/08_session/04_api.t
t/08_session/05_yaml.t
t/08_session/06_cookie.t
t/09_cookies/01_use.t
t/09_cookies/02_cookie_object.t
t/09_cookies/03_persistence.t
Expand All @@ -117,9 +117,10 @@ t/10_template/index.txt
t/11_logger/01_abstract.t
t/11_logger/02_factory.t
t/11_logger/03_file.t
t/11_logger/04_syslog.t
t/12_response/01_CRLF_injection.t
t/12_response/02_headers.t
t/lib/EasyMocker.pm
t/lib/TestApp.pm
TODO
t/TestUtils.pm
t/pod.t
TODO
21 changes: 10 additions & 11 deletions ROADMAP
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@

Dancer 1.300

[ ] Make Dancer a "core" distribution and
extract optional modules to separate
distributions (such as template engines,
session engines, ...)

[ ] Documentation review/refresh/rewrite

Dancer 1.200

[X] Remove the CGI.pm dependency
[ ] Support for file uploads
[ ] Provide a default dispatcher in
scaffolded applications.
[ ] Support for the 'header' helper in syntax


Dancer 1.130

[X] Support for the 'header' helper in syntax
for altering response headers from a route handler.
[X] Make Dancer a "core" distribution and
extract optional modules to separate
distributions (such as template engines,
session engines, ...)


Dancer 1.000

Expand Down
29 changes: 0 additions & 29 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,3 @@
1 - GET / -> first call, so browse the route tree
2 - GET / -> second call, return cache('/');

* Conditions support for route matching:

get '/foo', {agent => 'Songbird (\d\.\d)[\d\/]*?'} => sub {
...
};

* Prefix support

Could be great to be able to define a prefix path for each
route hanlder defined then.

Would work like the following:

prefix '/home';

# any route handler and before filter is applied to /home/*

get '/page1' => sub { }; # will match '/home/page1';

prefix undef;
# no more prefix

get '/page1' => sub { }; # will match /page1

And that should also work for before filters:

prefix '/home';
before sub { must_be_authenticated }; # this filter only applies to /home/* paths

159 changes: 82 additions & 77 deletions lib/Dancer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,47 @@ use Dancer::Handler;
use base 'Exporter';

$AUTHORITY = 'SUKRIA';
$VERSION = '1.123';
@EXPORT = qw(
any
before
cookies
content_type
dance
debug
del
dirname
error
false
get
header
headers
layout
load
logger
mime_type
options
params
pass
path
post
prefix
put
r
redirect
request
send_file
send_error
set
set_cookie
session
splat
status
template
true
var
vars
warning
$VERSION = '1.130';
@EXPORT = qw(
any
before
cookies
content_type
dance
debug
del
dirname
error
false
get
header
headers
layout
load
logger
mime_type
options
params
pass
path
post
prefix
put
r
redirect
request
send_file
send_error
set
set_cookie
session
splat
status
template
true
var
vars
warning
);

# Dancer's syntax
Expand All @@ -75,60 +75,65 @@ sub debug { Dancer::Logger->debug(@_) }
sub dirname { Dancer::FileUtils::dirname(@_) }
sub error { Dancer::Logger->error(@_) }
sub send_error { Dancer::Helpers->error(@_) }
sub false { 0 }
sub get { Dancer::Route->add('head', @_);
Dancer::Route->add('get', @_);}
sub headers { Dancer::Response::headers(@_); }
sub header { goto &headers; } # goto ftw!
sub layout { set(layout => shift) }
sub logger { set(logger => @_) }
sub load { require $_ for @_ }
sub mime_type { Dancer::Config::mime_types(@_) }
sub params { Dancer::SharedData->params }
sub false {0}

sub get {
Dancer::Route->add('head', @_);
Dancer::Route->add('get', @_);
}
sub headers { Dancer::Response::headers(@_); }
sub header { goto &headers; } # goto ftw!
sub layout { set(layout => shift) }
sub logger { set(logger => @_) }
sub load { require $_ for @_ }
sub mime_type { Dancer::Config::mime_types(@_) }
sub params { Dancer::SharedData->params }

# sub pass { Dancer::Response::pass() }
sub pass { pass_exception }
sub path { Dancer::FileUtils::path(@_) }
sub post { Dancer::Route->add('post', @_) }
sub prefix { Dancer::Route->prefix(@_) }
sub del { Dancer::Route->add('delete', @_) }
sub options { Dancer::Route->add('options', @_) }
sub put { Dancer::Route->add('put', @_) }
sub r { {regexp => $_[0]} }
sub redirect { Dancer::Helpers::redirect(@_) }
sub request { Dancer::SharedData->request }
sub send_file { Dancer::Helpers::send_file(@_) }
sub set { setting(@_) }
sub set_cookie { Dancer::Helpers::set_cookie(@_) }
sub session {
sub pass {pass_exception}
sub path { Dancer::FileUtils::path(@_) }
sub post { Dancer::Route->add('post', @_) }
sub prefix { Dancer::Route->prefix(@_) }
sub del { Dancer::Route->add('delete', @_) }
sub options { Dancer::Route->add('options', @_) }
sub put { Dancer::Route->add('put', @_) }
sub r { {regexp => $_[0]} }
sub redirect { Dancer::Helpers::redirect(@_) }
sub request { Dancer::SharedData->request }
sub send_file { Dancer::Helpers::send_file(@_) }
sub set { setting(@_) }
sub set_cookie { Dancer::Helpers::set_cookie(@_) }

sub session {
if (@_ == 0) {
return Dancer::Session->get;
}
else {
return (@_ == 1)
? Dancer::Session->read(@_)
: Dancer::Session->write(@_)
? Dancer::Session->read(@_)
: Dancer::Session->write(@_);
}
}
sub splat { @{ Dancer::SharedData->params->{splat} } }
sub status { Dancer::Response::status(@_) }
sub template { Dancer::Helpers::template(@_) }
sub true { 1 }
sub var { Dancer::SharedData->var(@_) }
sub vars { Dancer::SharedData->vars }
sub warning { Dancer::Logger->warning(@_) }
sub splat { @{Dancer::SharedData->params->{splat}} }
sub status { Dancer::Response::status(@_) }
sub template { Dancer::Helpers::template(@_) }
sub true {1}
sub var { Dancer::SharedData->var(@_) }
sub vars { Dancer::SharedData->vars }
sub warning { 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, $symbol) = @_;
my ($package, $script) = caller;
strict->import;
warnings->import;

$class->export_to_level( 1, $class, @EXPORT );
$class->export_to_level(1, $class, @EXPORT);

# if :syntax option exists, don't change settings
if ( $symbol && $symbol eq ':syntax' ) {
if ($symbol && $symbol eq ':syntax') {
return;
}

Expand Down
Loading

0 comments on commit 30a7231

Please sign in to comment.