line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SecondLife::Region; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$SecondLife::Region::VERSION = '0.900'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Second Life's region identifiers (a name, plus a location in the 2d grid of sims) |
6
|
2
|
|
|
2
|
|
1890
|
use Any::Moose; |
|
2
|
|
|
|
|
35624
|
|
|
2
|
|
|
|
|
15
|
|
7
|
2
|
|
|
2
|
|
1197
|
use overload q{""} => \&stringify; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
8
|
2
|
|
|
2
|
|
1179
|
use Regexp::Common qw/ RE_num_int /; |
|
2
|
|
|
|
|
2130
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'name' => ( is=>'rw', isa=>'Str' ); |
11
|
|
|
|
|
|
|
has [qw( x y )] => ( is=> 'rw', isa=>'Int' ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub BUILDARGS { |
14
|
3
|
|
|
3
|
1
|
875
|
my $self = shift; |
15
|
3
|
|
|
|
|
7
|
my( $region ) = @_; |
16
|
3
|
|
|
|
|
10
|
my $num = RE_num_int(); |
17
|
3
|
100
|
|
|
|
179
|
if ( @_==1 ) { |
|
|
50
|
|
|
|
|
|
18
|
2
|
50
|
|
|
|
99
|
if ( $region =~ /^ (.*?) \s* \( ($num), \s* ($num) \) $/xo ) { |
19
|
2
|
|
|
|
|
38
|
return { name=> $1, x=> $2, y=> $3 }; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
0
|
|
|
|
|
0
|
require Carp; |
23
|
0
|
|
|
|
|
0
|
Carp::croak( "Could not parse a region from $region" ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif ( ! (@_ % 2) ) { |
27
|
1
|
|
|
|
|
17
|
return { @_ }; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
0
|
|
|
|
|
0
|
require Carp; |
31
|
0
|
|
|
|
|
0
|
Carp::croak( "Invalid region constructor" ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub stringify { |
36
|
4
|
|
|
4
|
1
|
128
|
my $self = shift; |
37
|
4
|
|
|
|
|
40
|
return $self->name . " (" . $self->x . ", " . $self->y .")"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
|
62170
|
no Any::Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
42
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |