| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
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
|
|
|
|
|
|
|
BEGIN { |
|
27
|
4
|
|
|
4
|
|
119
|
$Net::OSCAR::Screenname::VERSION = '1.928'; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$REVISION = '$Revision$'; |
|
31
|
|
|
|
|
|
|
|
|
32
|
4
|
|
|
4
|
|
20
|
use strict; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
119
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
4
|
|
|
4
|
|
20
|
use Net::OSCAR::Utility qw(normalize); |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
346
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use overload |
|
37
|
4
|
|
|
|
|
41
|
"cmp" => "compare", |
|
38
|
|
|
|
|
|
|
'""' => "stringify", |
|
39
|
4
|
|
|
4
|
|
22
|
"bool" => "boolify"; |
|
|
4
|
|
|
|
|
5
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new($$) { |
|
42
|
2
|
50
|
33
|
2
|
0
|
20
|
return $_[1] if ref($_[0]) or UNIVERSAL::isa($_[1], "Net::OSCAR::Screenname"); |
|
43
|
2
|
|
50
|
|
|
8
|
my $class = ref($_[0]) || $_[0] || "Net::OSCAR::Screenname"; |
|
44
|
2
|
|
|
|
|
3
|
shift; |
|
45
|
2
|
|
|
|
|
3
|
my $name = $_[0]; |
|
46
|
2
|
50
|
|
|
|
7
|
my $self = ref($name) eq "SCALAR" ? $name : \"$name"; |
|
47
|
2
|
|
|
|
|
4
|
bless $self, $class; |
|
48
|
2
|
|
|
|
|
5
|
return $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub compare { |
|
52
|
0
|
|
|
0
|
0
|
|
my($self, $comparand) = @_; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return normalize($$self) cmp normalize($comparand); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
0
|
|
sub stringify { my $self = shift; return $$self; } |
|
|
0
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub boolify { |
|
60
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
61
|
0
|
0
|
0
|
|
|
|
return 0 if !defined($$self) or $$self eq "" or $$self eq "0"; |
|
|
|
|
0
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return 1; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |