File Coverage

blib/lib/Protocol/XMPP/Element/Message.pm
Criterion Covered Total %
statement 12 17 70.5
branch 0 4 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 30 56.6


line stmt bran cond sub pod time code
1             package Protocol::XMPP::Element::Message;
2              
3 1     1   170883 use strict;
  1         2  
  1         34  
4 1     1   4 use warnings;
  1         1  
  1         62  
5 1     1   3 use parent qw(Protocol::XMPP::ElementBase);
  1         1  
  1         7  
6              
7             our $VERSION = '0.007'; ## VERSION
8              
9 1     1   416 use Protocol::XMPP::Message;
  1         2  
  1         165  
10              
11             =head1 NAME
12              
13             Protocol::XMPP::Feature - register ability to deal with a specific feature
14              
15             =head1 SYNOPSIS
16              
17             =head1 DESCRIPTION
18              
19             =head1 METHODS
20              
21             =cut
22              
23             =head2 end_element
24              
25             =cut
26              
27             sub end_element {
28 0     0 1   my $self = shift;
29              
30 0   0       $self->{$_} ||= $self->attributes->{$_} for qw(from to type);
31             my $msg = Protocol::XMPP::Message->new(
32             stream => $self->stream,
33             from => $self->{from},
34             to => $self->{to},
35             type => $self->{type},
36             subject => $self->{subject},
37             body => $self->{body},
38             (exists $self->{nick})
39             ? (nick => $self->{nick})
40 0 0         : ()
41             );
42 0 0         $self->debug("Had message from " . $msg->from . ($msg->subject ? (" subject " . $msg->subject) : '') . " body " . $msg->body);
43 0           $self->stream->dispatch_event('message', $msg);
44             }
45              
46             1;
47              
48             __END__