« 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
Condition33%1/3
ref $_[0] or UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | ▶ | my $class = ref($_[0]) || $_[0] || "Net::OSCAR::Screenname"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
ref $_[0] || $_[0] || 'Net::OSCAR::Screenname'
ref $_[0] or $_[0]
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]
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | my $name = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | my $self = ref($name) eq "SCALAR" ? $name : \"$name"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
not defined $$self or $$self eq "" or $$self eq 0
not defined $$self or $$self eq ""
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
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||