| author | Vincent Tondellier <tonton+hg@team1664.org> |
| Sun, 18 Dec 2016 21:11:27 +0100 | |
| changeset 122 | 8692800ec9ba |
| parent 78 | 0ebef32c34af |
| permissions | -rw-r--r-- |
|
37
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
1 |
# This program is free software: you can redistribute it and/or modify |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
2 |
# it under the terms of the GNU General Public License as published by |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
3 |
# the Free Software Foundation, either version 3 of the License, or |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
4 |
# (at your option) any later version. |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
5 |
# |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
6 |
# This program is distributed in the hope that it will be useful, |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
7 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
9 |
# GNU General Public License for more details. |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
10 |
# |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
11 |
# You should have received a copy of the GNU General Public License |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
12 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
13 |
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
37
diff
changeset
|
14 |
package CrashTest::Helper::XmlEscape; |
|
122
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
78
diff
changeset
|
15 |
|
|
37
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
16 |
use Mojo::Base 'Mojolicious::Plugin'; |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
17 |
use Mojo::ByteStream qw/b/; |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
18 |
use Mojo::Util qw/xml_escape/; |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
19 |
|
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
20 |
sub register {
|
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
21 |
my ($self, $mojo, $params) = @_; |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
22 |
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
37
diff
changeset
|
23 |
$mojo->helper(xml_escape_block => sub { return $self->xml_escape_block(@_); });
|
|
37
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
24 |
} |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
25 |
|
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
26 |
sub xml_escape_block {
|
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
27 |
my ($self, $c, $block) = @_; |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
28 |
my $result = $block->(); |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
29 |
return b(xml_escape($result)); |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
30 |
} |
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
31 |
|
|
013953be0f3b
Add a new backtrace-processing filter stack
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
32 |
1; |