« blib/lib/NewsExtractor/SiteSpecificExtractor/www_fountmedia_io.pm
↑ Summary
blib/lib/NewsExtractor/SiteSpecificExtractor/ChinaTimes.pm »
| 1 | package NewsExtractor::Article; | ||
| 2 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use NewsExtractor::Types qw< Text Text1K >; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | has headline => ( required => 1, is => 'ro', isa => Text1K ); | |
| 6 | 1 | has article_body => ( required => 1, is => 'ro', isa => Text ); | |
| 7 | |||
| 8 | 1 | has dateline => ( predicate => 1, is => 'ro', isa => Text1K ); | |
| 9 | 1 | has journalist => ( predicate => 1, is => 'ro', isa => Text1K ); | |
| 10 | |||
| 11 | sub TO_JSON { | ||
| 12 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
TO_JSON: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 13 | return { | ||
| 14 | 0 | headline => $self->headline, | |
| 15 | article_body => $self->article_body, | ||
| 16 | dateline => $self->dateline, | ||
| 17 | journalist => $self->journalist, | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | 1 | 1; | |
| 22 | |||
| 23 | __END__ | ||
| 24 | |||
| 25 | =head1 Name | ||
| 26 | |||
| 27 | NewsExtractor::Article - A data class for containing news article. | ||
| 28 | |||
| 29 | =head1 Description | ||
| 30 | |||
| 31 | This is a data class that contains an news article extracted from some web sites. | ||
| 32 | The instances of this data class has these attributes: | ||
| 33 | |||
| 34 | =over 4 | ||
| 35 | |||
| 36 | =item headline | ||
| 37 | |||
| 38 | Mandatory. Str. Refer to the headline of a news article. | ||
| 39 | |||
| 40 | =item article_body | ||
| 41 | |||
| 42 | Mandatory. Str. Refer to the body of a news article. | ||
| 43 | |||
| 44 | =item dateline | ||
| 45 | |||
| 46 | Optional. One must check the presense of this attribute with C<has_dateline> | ||
| 47 | method before taking the value of it. | ||
| 48 | |||
| 49 | =item journalist | ||
| 50 | |||
| 51 | Optional. One must check the presense of this attribute with C<has_journalist> | ||
| 52 | method before taking the value of it. | ||
| 53 | |||
| 54 | =back | ||
| 55 | |||
| 56 | =cut | ||