| 1 | package XML::Loy::OStatus; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use XML::Loy with => ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | prefix => 'ostatus', | ||||||||||
| 7 | namespace => 'http://ostatus.org/schema/1.0/' | ||||||||||
| 8 | 1 | ); | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Carp qw/carp/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | # No constructor | ||||||||||
| 13 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 14 | 0 | carp 'Only use ' . __PACKAGE__ . ' as an extension to Atom'; | |||||||||
| 15 | 0 | return; | |||||||||
| 16 | }; | ||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | # Add 'attention' link | ||||||||||
| 20 | 2 | ▶ | sub attention { | ||||||||
|
Subroutine
attention: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 21 | 2 | shift->_ostatus_link( attention => @_ ); | |||||||||
| 22 | }; | ||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | # Add 'conversation' link | ||||||||||
| 26 | 2 | ▶ | sub conversation { | ||||||||
|
Subroutine
conversation: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 27 | 2 | shift->_ostatus_link( conversation => @_ ); | |||||||||
| 28 | }; | ||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | # Link elements | ||||||||||
| 32 | 4 | ▶ | sub _ostatus_link { | ||||||||
|
Subroutine
_ostatus_link: called CC=4 SCAR=14.0
| |||||||||||
| 33 | 4 | my $self = shift; | |||||||||
| 34 | 4 | my $rel = 'ostatus:' . shift; | |||||||||
| 35 | |||||||||||
| 36 | # Get href from link element | ||||||||||
| 37 | 4 | ▶ | unless (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 2 | ▶ | my $att = $self->link($rel) or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 2 | ▶ | $att = $att->[0] or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 2 | return $att->attr('href'); | |||||||||
| 41 | }; | ||||||||||
| 42 | |||||||||||
| 43 | # Create new link element | ||||||||||
| 44 | 2 | return $self->link( | |||||||||
| 45 | rel => $rel, | ||||||||||
| 46 | href => shift, | ||||||||||
| 47 | @_ | ||||||||||
| 48 | ); | ||||||||||
| 49 | }; | ||||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | # OStatus activity 'leave' | ||||||||||
| 53 | 1 | ▶ | sub verb_leave { | ||||||||
|
Subroutine
verb_leave: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 54 | 1 | shift->verb( __PACKAGE__->_namespace . 'leave'); | |||||||||
| 55 | }; | ||||||||||
| 56 | |||||||||||
| 57 | |||||||||||
| 58 | # OStatus activity 'unfollow' | ||||||||||
| 59 | 1 | ▶ | sub verb_unfollow { | ||||||||
|
Subroutine
verb_unfollow: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 60 | 1 | shift->verb( __PACKAGE__->_namespace . 'unfollow'); | |||||||||
| 61 | }; | ||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | # OStatus activity 'unfavorite' | ||||||||||
| 65 | 1 | ▶ | sub verb_unfavorite { | ||||||||
|
Subroutine
verb_unfavorite: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 66 | 1 | shift->verb( __PACKAGE__->_namespace . 'unfavorite'); | |||||||||
| 67 | }; | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | 1 | 1; | |||||||||
| 71 | |||||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||