8 my $u = URI->new('sip:phone@domain.ext');
9 print "not " unless $u->user eq 'phone' &&
10 $u->host eq 'domain.ext' &&
12 $u eq 'sip:phone@domain.ext';
15 $u->host_port('otherdomain.int:9999');
16 print "not " unless $u->host eq 'otherdomain.int' &&
18 $u eq 'sip:phone@otherdomain.int:9999';
23 print "not " unless $u->host eq 'otherdomain.int' &&
25 $u eq 'sip:phone@otherdomain.int';
28 $u->user('voicemail');
29 print "not " unless $u->user eq 'voicemail' &&
30 $u eq 'sip:voicemail@otherdomain.int';
33 $u = URI->new('sip:phone@domain.ext?Subject=Meeting&Priority=Urgent');
34 print "not " unless $u->host eq 'domain.ext' &&
35 $u->query eq 'Subject=Meeting&Priority=Urgent';
38 $u->query_form(Subject => 'Lunch', Priority => 'Low');
39 my @q = $u->query_form;
40 print "not " unless $u->host eq 'domain.ext' &&
41 $u->query eq 'Subject=Lunch&Priority=Low' &&
42 @q == 4 && "@q" eq "Subject Lunch Priority Low";
45 $u = URI->new('sip:phone@domain.ext;maddr=127.0.0.1;ttl=16');
46 print "not " unless $u->host eq 'domain.ext' &&
47 $u->params eq 'maddr=127.0.0.1;ttl=16';
50 $u = URI->new('sip:phone@domain.ext?Subject=Meeting&Priority=Urgent');
51 $u->params_form(maddr => '127.0.0.1', ttl => '16');
52 my @p = $u->params_form;
53 print "not " unless $u->host eq 'domain.ext' &&
54 $u->query eq 'Subject=Meeting&Priority=Urgent' &&
55 $u->params eq 'maddr=127.0.0.1;ttl=16' &&
56 @p == 4 && "@p" eq "maddr 127.0.0.1 ttl 16";
60 $u = URI->new_abs('sip:phone@domain.ext', 'sip:foo@domain2.ext');
61 print "not " unless $u eq 'sip:phone@domain.ext';
64 $u = URI->new('sip:phone@domain.ext');
65 print "not " unless $u eq $u->abs('http://www.cpan.org/');
68 print "not " unless $u eq $u->rel('http://www.cpan.org/');