File Coverage

lib/AMQP.pm
Criterion Covered Total %
statement 7 13 53.8
branch 0 2 0.0
condition 2 12 16.6
subroutine 2 2 100.0
pod 0 1 0.0
total 11 30 36.6


line stmt bran cond sub pod time code
1              
2             package AMQP;
3             our $VERSION = '0.01';
4              
5 2     2   710 use Mojo::Base -base;
  2         3  
  2         17  
6              
7             sub server {
8 1     1 0 2198 my ($self,$url) = @_;
9 1   50     5 $url ||= ''; # incase we don't pass a url
10 1         6 $url =~ /amqp:\/\/
11             (?[^:]+):
12             (?[^@]+)@
13             (?[^:\/]+):
14             (?\d+)\/
15             (?[^\/]*)
16             /x;
17 1   50     242 $self->host($+{'hostname'} || 'localhost');
18 0   0       $self->port($+{'port'} || 5672);
19 0   0       $self->vhost($+{'vhost'} || '/');
20 0   0       $self->username($+{'username'} || 'guest');
21 0   0       $self->password($+{'password'} || 'guest');
22 0 0         say "amqp://" . $self->host . ":" . $self->port . $self->vhost if $self->debug;
23 0           $self;
24             }
25              
26             1;
27              
28             __DATA__