| 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 => ( | |||||||||
| 6 | prefix => 'ostatus', | ||||||||||
| 7 | namespace => 'http://ostatus.org/schema/1.0/' | ||||||||||
| 8 | 1 | ▶ | ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Carp qw/carp/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | # No constructor | ||||||||||
| 13 | sub new { | ||||||||||
| 14 | 0 | ▶ | carp 'Only use ' . __PACKAGE__ . ' as an extension to Atom'; | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 15 | 0 | return; | |||||||||
| 16 | }; | ||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | # Add 'attention' link | ||||||||||
| 20 | sub attention { | ||||||||||
| 21 | 2 | ▶ | shift->_ostatus_link( attention => @_ ); | ||||||||
|
Subroutine
attention: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | }; | ||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | # Add 'conversation' link | ||||||||||
| 26 | sub conversation { | ||||||||||
| 27 | 2 | ▶ | shift->_ostatus_link( conversation => @_ ); | ||||||||
|
Subroutine
conversation: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | }; | ||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | # Link elements | ||||||||||
| 32 | sub _ostatus_link { | ||||||||||
| 33 | 4 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_ostatus_link: called CC=4 SCAR=14.0
| |||||||||||
| 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 | sub verb_leave { | ||||||||||
| 54 | 1 | ▶ | shift->verb( __PACKAGE__->_namespace . 'leave'); | ||||||||
|
Subroutine
verb_leave: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 55 | }; | ||||||||||
| 56 | |||||||||||
| 57 | |||||||||||
| 58 | # OStatus activity 'unfollow' | ||||||||||
| 59 | sub verb_unfollow { | ||||||||||
| 60 | 1 | ▶ | shift->verb( __PACKAGE__->_namespace . 'unfollow'); | ||||||||
|
Subroutine
verb_unfollow: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 61 | }; | ||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | # OStatus activity 'unfavorite' | ||||||||||
| 65 | sub verb_unfavorite { | ||||||||||
| 66 | 1 | ▶ | shift->verb( __PACKAGE__->_namespace . 'unfavorite'); | ||||||||
|
Subroutine
verb_unfavorite: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 67 | }; | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | 1 | 1; | |||||||||
| 71 | |||||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||