lib/XML/Loy/OStatus.pm

filter: Statementstmt 92.5% 25 / 27 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 100% 6 / 6 totaltotal 90.0% 45 / 50 CC 4 SCAR 6.7
CC
4
Cov
88%
_ostatus_link
4.1
new
2.0
BEGIN
1.0
CRAP 1.9
« blib/lib/XML/Loy/ActivityStreams.pm ↑ Summary blib/lib/XML/Loy/HostMeta.pm »
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
BranchTrueFalseTotal
unless (@_) 2 2 4
38 2 ▶ my $att = $self->link($rel) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $att = $self->link($rel) or return 2 0 2
39 2 ▶ $att = $att->[0] or return;
Branch: 1 branch
BranchTrueFalseTotal
$att = $att->[0] or return 2 0 2
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__
« blib/lib/XML/Loy/ActivityStreams.pm ↑ Summary blib/lib/XML/Loy/HostMeta.pm »