blib/lib/Net/OSCAR/Screenname.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 33.3% 2 / 6 Conditioncond 21.4% 3 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 4 totaltotal 44.6% 29 / 65 CC 9 SCAR 21.3
CC
9
Cov
52%
boolify
20.0
new
7.8
compare
2.0
CRAP 8.4
« blib/lib/Net/OSCAR/ServerCallbacks.pm ↑ Summary blib/lib/Net/OSCAR/ServerCallbacks/4/outgoing_IM.pm »
1 =pod
2  
3 =head1 NAME
4  
5 Net::OSCAR::Screenname -- OSCAR screenname class
6  
7 =head1 VERSION
8  
9 version 1.928
10  
11 =head1 DESCRIPTION
12  
13 This class overrides a few operators to transparently get
14 appropriate behavior for OSCAR screennames. Screennames
15 are case-insensitive and whitespace-insensitive. So, if you
16 do
17  
18 $a = Net::OSCAR::Screenname->new("Some Dude");
19 print "Yay!\n" if $a eq "somedude";
20  
21 will be true.
22  
23 =cut
24  
25 package Net::OSCAR::Screenname;
26 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
27 4 $Net::OSCAR::Screenname::VERSION = '1.928';
28 }
29  
30 4 $REVISION = '$Revision$';
31  
32 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 4 ▶use Net::OSCAR::Utility qw(normalize);
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 use overload
37 4 ▶ "cmp" => "compare",
Subroutine BEGIN: called CC=1 SCAR=0.0
38 '""' => "stringify",
39 4 "bool" => "boolify";
40  
41 2 ▶sub new($$) {
Subroutine new: called CC=6 SCAR=20.5
Pod undocumented
42 2 ▶ return $_[1] if ref($_[0]) or UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname");
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] or UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname") 0 2 2
Condition33%1/3
ref $_[0] or UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname")
l!l&&r!l&&!r
002
MC/DC0%0/2
ref $_[0] or UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname")
ref $_[0] UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname")
Truth table33%1/3
A or B
A= ref $_[0]B= UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname")
ABresult
1X1
011
000
43 2 ▶ my $class = ref($_[0]) || $_[0] || "Net::OSCAR::Screenname";
Condition40%2/5
ref $_[0] || $_[0] || 'Net::OSCAR::Screenname'
l!l
20
ref $_[0] or $_[0]
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $_[0] || $_[0] || 'Net::OSCAR::Screenname'
ref $_[0] $_[0]
Truth table33%1/3
A or B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
44 2 shift;
45 2 my $name = $_[0];
46 2 ▶ my $self = ref($name) eq "SCALAR" ? $name : \"$name";
Branch: 1 branch
BranchTrueFalseTotal
ref $name eq 'SCALAR' ? : 0 2 2
47 2 bless $self, $class;
48 2 return $self;
49 }
50  
51 0 ▶sub compare {
Subroutine compare: not called CC=1 SCAR=6.9
Pod undocumented
52 0 my($self, $comparand) = @_;
53  
54 0 return normalize($$self) cmp normalize($comparand);
55 }
56  
57 0 ▶sub stringify { my $self = shift; return $$self; }
Subroutine stringify: not called CC=1 SCAR=6.9
Pod undocumented
58  
59 0 ▶sub boolify {
Subroutine boolify: not called CC=4 SCAR=30.0
Pod undocumented
60 0 my $self = shift;
61 0 ▶ return 0 if !defined($$self) or $$self eq "" or $$self eq "0";
Branch: 1 branch
BranchTrueFalseTotal
if not defined $$self or $$self eq "" or $$self eq 0 0 0 0
Condition0%0/6
not defined $$self or $$self eq "" or $$self eq 0
l!l&&r!l&&!r
000
not defined $$self or $$self eq ""
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $$self or $$self eq "" or $$self eq 0
not defined $$self $$self eq "" $$self eq 0
Truth table0%0/4
not(A) or B or C
A= not defined $$selfB= $$self eq ""C= $$self eq 0
ABCresult
1XX1
01X1
0011
0000
62 0 return 1;
63 }
64  
65 4 1;
« blib/lib/Net/OSCAR/ServerCallbacks.pm ↑ Summary blib/lib/Net/OSCAR/ServerCallbacks/4/outgoing_IM.pm »