| 1 | package Tweet::ToDelicious::Entity::OnTweet; | ||||||||||
| 2 | |||||||||||
| 3 | 15 | ▶ | use v5.14; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 15 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 15 | ▶ | use parent 'Tweet::ToDelicious::Entity::Interface'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 15 | ▶ | use List::MoreUtils qw(uniq); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 15 | ▶ | use Log::Minimal; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 15 | ▶ | use Class::Accessor::Lite ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 15 | new => 1, | |||||||||
| 10 | ro => [qw(text in_reply_to_screen_name)], | ||||||||||
| 11 | 15 | ); | |||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub screen_name { $_[0]->{user}->{screen_name} } | ||||||||
|
Subroutine
screen_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 14 | |||||||||||
| 15 | 4 | ▶ | sub urls { | ||||||||
|
Subroutine
urls: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 16 | 4 | my $self = shift; | |||||||||
| 17 | 4 | state @urls; | |||||||||
| 18 | 4 | @urls = uniq( map $_->{expanded_url}, @{ $self->{entities}->{urls} } ); | |||||||||
| 19 | 4 | return @urls; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 4 | ▶ | sub tags { | ||||||||
|
Subroutine
tags: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 4 | my $self = shift; | |||||||||
| 24 | 4 | my @tags = map $_->{text}, @{ $self->{entities}->{hashtags} }; | |||||||||
| 25 | 4 | my $text = $self->text; | |||||||||
| 26 | 4 | my (@from_text) = $text =~ m/\[([^\]]+?)\]/g; | |||||||||
| 27 | 4 | ▶ | return uniq( @tags, @from_text, $self->{favorited} ? 'favorite' : () ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 3 | ▶ | sub posts { | ||||||||
|
Subroutine
posts: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 31 | 3 | my $self = shift; | |||||||||
| 32 | 3 | my @urls = $self->urls; | |||||||||
| 33 | 3 | my @posts; | |||||||||
| 34 | 3 | ▶ | if ( @urls > 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 2 | my $tags = join ',', $self->tags, 'via:tweet2delicious'; | |||||||||
| 36 | 2 | my $text = $self->text; | |||||||||
| 37 | 2 | for my $url (@urls) { | |||||||||
| 38 | 4 | push @posts, | |||||||||
| 39 | { | ||||||||||
| 40 | url => $url, | ||||||||||
| 41 | tags => $tags, | ||||||||||
| 42 | description => $text, | ||||||||||
| 43 | replace => 1 | ||||||||||
| 44 | }; | ||||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | 3 | return @posts; | |||||||||
| 48 | } | ||||||||||
| 49 | 15 | 1; | |||||||||