Skip to content

Commit 8c76c89

Browse files
author
Alexis Sukrieh
committed
Chagelog and README.md update
1 parent 58c91f3 commit 8c76c89

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

Changelog

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{{$NEXT}}
22

3+
* Documentation updates.
4+
5+
0.02 2015-10-22 15:20:18+02:00 Europe/Paris
6+
37
* New API (this breaks 0.01), cleaner and lighter interface. No more need
48
for the final instruction "declare_probability_routes", better design.
59
Idea by veryrusty, after a little lunch brainstomring session with sawyer

README.md

+22-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Dancer2::Plugin::ProbabilityRoute - plugin to define behavior with probability m
44

55
# VERSION
66

7-
version 0.02
7+
version 0.03
88

99
# SYNOPSIS
1010

@@ -18,7 +18,7 @@ version 0.02
1818
"A is returned for you";
1919
},
2020
50 => sub {
21-
"A is returned for you";
21+
"B is returned for you";
2222
}
2323
};
2424

@@ -43,16 +43,25 @@ route as long as they don't purge their cookies.
4343

4444
## probability\_route
4545

46-
Use this keyword to declare a route that gets triggered only under a given
47-
probability.
48-
The sequence is important: the first declaration for a given method/path tuple
49-
is the default version of the route.
46+
Use this keyword to declare a route that is devided into multiple versions,
47+
each them triggered for a certain percentage of users.
48+
49+
The sequence is important: the first declaration is the default version of
50+
the route (if the user has no cookies).
5051

5152
Here is an example of a 30, 50, 20 split:
5253

53-
probability_route 30, 'get', '/' => sub { "30% chances to get there" };
54-
probability_route 50, 'get', '/' => sub { "50% chances to get there" };
55-
probability_route 20, 'get', '/' => sub { "20% chances to get there" };
54+
get '/test' => probability
55+
30 => sub {
56+
"30% of users see that.";
57+
},
58+
50 => sub {
59+
"50% of users see that.";
60+
},
61+
20 => sub {
62+
"20% of users see that.";
63+
},
64+
};
5665

5766
To provide stability for each user, the session ID is used as a pivot, to build
5867
a _user\_score_, which is an number between 0 and 99.
@@ -89,6 +98,10 @@ This module has been written during the
8998
design and helped me make this module so easy to write it took less than half
9099
a day to get it into CPAN.
91100

101+
The second release was made thanks to the observations of
102+
[Russell Jenkins](http://search.cpan.org/~russellj/) who suggested a better API,
103+
allowing for a more straight-forward approach.
104+
92105
# AUTHOR
93106

94107
Alexis Sukrieh <[email protected]>

0 commit comments

Comments
 (0)