line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Facebook::InstantArticle::Paragraph; |
2
|
2
|
|
|
2
|
|
11
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
3
|
2
|
|
|
2
|
|
14320
|
use namespace::autoclean; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
43
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Facebook::InstantArticle::BaseElement'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'text' => ( |
8
|
|
|
|
|
|
|
isa => 'Str', |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
required => 1, |
11
|
|
|
|
|
|
|
default => '', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
around BUILDARGS => sub { |
15
|
|
|
|
|
|
|
my $orig = shift; |
16
|
|
|
|
|
|
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if ( @_ == 1 && !ref $_[0] ) { |
19
|
|
|
|
|
|
|
return $class->$orig( text => $_[0] ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
|
|
|
|
|
|
return $class->$orig( @_ ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'is_valid' => ( |
27
|
|
|
|
|
|
|
isa => 'Bool', |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
lazy => 1, |
30
|
|
|
|
|
|
|
default => sub { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return length $self->squeeze( $self->text ) ? 1 : 0; |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'as_xml_gen' => ( |
38
|
|
|
|
|
|
|
isa => 'Object', |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
lazy => 1, |
41
|
|
|
|
|
|
|
builder => '_build_as_xml_gen', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _build_as_xml_gen { |
45
|
3
|
|
|
3
|
|
7
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
31
|
my $gen = XML::Generator->new( ':pretty' ); |
48
|
|
|
|
|
|
|
|
49
|
3
|
|
|
|
|
581
|
return $gen->p( |
50
|
|
|
|
|
|
|
\$self->text, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |