1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
*** Middleware
After the [[http://journeesperl.fr/fpw2010/][French Perl Workshop]], we
decided to focus our efforts on bringing middleware into Dancer. As the
.psgi script is now obsolete, we wanted to simplify the middleware
configuration for users not familiar with Plack.
It's now possible to load a middleware by adding it to your
configuration:
#+BEGIN_EXAMPLE
plack_middlewares:
Debug:
- panels
-
- DBITrace
- Memory
- Timer
#+END_EXAMPLE
*** YAPC::Eu 2010
During YAPC::EU, I've been happy to meet with
[[http://github.com/squeeks][squeeks]],
[[http://blogs.perl.org/users/sawyer_x/][sawyer]] and
[[http://github.com/mberends][Martin Berends]]. Sadly, we didn't have
much time to talk and do some coding.
I had already met Martin during the FPW, where he started to port Dancer
to Perl6. His first objective is to have
[[http://github.com/mberends/http-server-simple][HTTP::Server::Simple]]
work. I was really impressed with his works; if I manage to find some
spare time soon, I will join his effort.
*** Dancer's application
In august, [[http://www.sukria.net/][Alexis]] brought a big effort to
refactor the core of Dancer, to add the possibility to "plug" components
to your application. This required a lot of rewriting, but in the
meantime, we added more tests to ensure nothing would break.
With this feature, you can do the following:
#+BEGIN_SRC perl
package myapp::forum;
use Dancer ':syntax';
before => sub {
...
};
get '/' => sub {
...
};
package myapp:blog;
use Dancer ':syntax';
load_app 'myapp::forum', prefix => '/forum';
before => sub {
...
};
get '/' => sub {
...
};
#+END_SRC
Now you can request */* and */forum*. The before filter declared in the
package *myapp::forum* will be executed when the */forum* path is
matched, and the filter in *myapp::blog* will be executed for */*.
*** QA
The weekend following the YAPC::EU, we held a small hackaton/QA day on
irc. Not many people were present, but we managed to achieve some
results:
- reached the 1K tests
- documentation cleanup
- added Hooks
- improved our code coverage
Today our code average is over 92%, and we have more than 1200 tests.
With the new hook system, two new keywords have been added:
*before\_template* and *after*. They work as the *before* keyword,
except the *before\_template* is executed before sending the tokens to
the template, so you can modify them (a small example can be found in
the
[[http://git.lumberjaph.net/p5-dancer-plugin-18n.git/][Dancer::Plugin::i18n]]).
The *after* is executed before the response is sent to the user.
Sukria has also set up an autobuild system for our two main branches.
Every 15 minutes, the test suite is executed when there is a new commit,
and builds a report. Code coverage is also measured, so we can always
know the state of our various development cycles.
*** WebSocket
This is the question that came back from time to time: when/will Dancer
support websocket ?
We investigated various ways to do this:
- new async. handler
- writing our own implementation
- ...
I didn't want to write a websocket implementation for Dancer, as the
spec are not yet final and it's not easy to do. Thanks to
[[http://github.com/clkao][clkao]], we didn't have to care about all
this, as he already wrote a Plack middleware for this:
[[http://search.cpan.org/perldoc?Web::Hippie::Pipe][Web::Hippie]].
So, what we did, is to use this middleware and add some syntactic sugar
so people can use it easily in their applications. A small application
is available [[http://git.lumberjaph.net/p5-dancer-chat.git/][here]].
This is not yet complete, it's only available in the 'devel' branch, and
subject to change. A small code sample:
#+BEGIN_SRC perl
websocket '/new_listener' => sub {
my $env = request->env;
my $room = $env->{'hippie.args'};
my $topic = $env->{'hippie.bus'}->topic($room);
$env->{'hippie.listener'}->subscribe($topic);
};
websocket '/message' => sub {
my $env = request->env;
my $room = $env->{'hippie.args'};
my $topic = $env->{'hippie.bus'}->topic($room);
my $msg = $env->{'hippie.message'};
$msg->{time} = time;
$msg->{address} = $env->{REMOTE_ADDR};
$topic->publish($msg);
};
#+END_SRC
As you can see, a lot of stuff can be improved quite easily in terms of
syntax.
*** Deployment
We're also in the process of reworking our current Deployment
documentation. Lots of people are trying to deploy Dancer using various
configurations, and not all are well documented, or don't work as
expected. If you use Dancer, and have deployed an application in a way
not documened in our Deployement documentation, please join us on irc
(#dancer on irc.perl.org) or contact us on the mailing list, or even
better, send us a patch, so we can improve this part.
*** Future
There is also our next Dancer's meeting meeting to organize, at the end
of Septembre.
In October will take place the 2nd OSDC.fr, where I will talk about
Plack, and alexis will present Dancer.
I want to thank my company ([[http://linkfluence.net][Linkfluence]]) and
my boss ([[http://twitter.com/cmaussan][Camille]]) for giving me time to
code on Dancer at work.
As always, thanks to blob for reviewing my (slightly improving) english
:)
|