NAME
SecondLife::Region - Second Life's region identifiers (a name, plus a location in the 2d grid of sims)
VERSION
version 0.900
SYNOPSIS
use SecondLife::DataTypes;
my $region = SecondLife::Region->new( name=>"Dew Drop", x=>236544, y=>242944 );
# Or from a string, for instance, in a PSGI handler:
use Plack::Request;
sub psgi_handler {
my $req = Plack::Request->new( shift );
my $region = SecondLife::Region->new( $req->header('X-SecondLife-Region') );
my $res = $req->new_response( 200 );
$res->content_type('text/plain');
$res->body(
"This request was made from the ".$region->name." region of SecondLife\n".
"Which is located at the global coordinates ".$region->x.", ".$region->y."\n".
"This would be expressed as $region normally."
);
return $res->finalize;
}
DESCRIPTION
This parses and emits Second Life region identifiers, which are made up of a name and coordinates of the region on the grid. These can be turned into the global coordinates for the top left of the region by multiplying by 256.
CONSTRUCTOR
our method new($class: Str :$name, Int :$x, Int :$y)
our method new($class: Str $region_str ) returns SecondLife::Region
The constructor either takes a single argument, a region string you want to parse in the format: Region Name (X, Y) Or a hash with the attributes you want to have started initialized.
ATTRIBUTES
has Str $.name is rw
The name of the region
has Int $.x is rw
has Int $.y is rw
The X and Y coordinates of the region on the grid.
METHODS
our method stringify() returns Str
Returns the region and coordinates as a string in the same form that Second Life does. Evalauting the object as a string will also produce this result.
SEE ALSO
Please see those modules/websites for more information related to this module.
AUTHOR
Rebecca Turner <becca@referencethis.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Rebecca Turner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.