line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RapidApp::HTML::RawHtml; |
2
|
6
|
|
|
6
|
|
35
|
use strict; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
144
|
|
3
|
6
|
|
|
6
|
|
24
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
218
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
RawHtml |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This miniature class is used to flag a scalar as containing text/html. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This should be used anywhere that you want to allow the API user to write direct |
14
|
|
|
|
|
|
|
HTML, but want to provide the convenience of letting them just specify plaintext |
15
|
|
|
|
|
|
|
for most cases. To process it, just check whether the string isa("RapidApp::HTML::RawHtml") |
16
|
|
|
|
|
|
|
before deciding whether to call escape_entities on the string. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
You can use the sugar method "ashtml" (RapidApp::Sugar.pm) to make this conversion for you. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
There is also a convenient sugar method "rawhtml". |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
6
|
|
30
|
use overload '""' => \&_stringify_static, fallback => 1; # to-string operator overload |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
40
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
0
|
|
|
0
|
0
|
|
my ($class, $html)= @_; |
28
|
0
|
|
|
|
|
|
return bless \$html, $class; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
0
|
|
sub stringify { ${(shift)} } |
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# This method exists because 'overload' doesn't do dynamic method dispatch |
34
|
|
|
|
|
|
|
# We use a named method (rather than overload '""' => sub { ... }) to improve |
35
|
|
|
|
|
|
|
# readibility of stack traces. |
36
|
0
|
|
|
0
|
|
|
sub _stringify_static { (shift)->stringify } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |