| Games-AssaultCube documentation | Contained in the Games-AssaultCube distribution. |
Games::AssaultCube::Log::Line::Base::RoleInfo - The RoleInfo role for subclasses
This module provides the RoleInfo role for subclasses.
This module provides the RoleInfo role for subclasses. This is the AssaultCube player "role" in the game.
Those attributes are part of the role, and will be applied to subclasses that use this.
The id of the client's role
0 = DEAFULT 1 = ADMIN
The role name of the client ( DEFAULT, ADMIN )
Apocalypse <apocal@cpan.org>
Props goes to the BS clan for the support!
This project is sponsored by http://cubestats.net
Copyright 2009 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Games-AssaultCube documentation | Contained in the Games-AssaultCube distribution. |
# the "roleinfo" role package Games::AssaultCube::Log::Line::Base::RoleInfo; use Moose::Role; # Initialize our version use vars qw( $VERSION ); $VERSION = '0.04'; use Games::AssaultCube::Utils qw( get_role_from_name get_role_name ); has 'role' => ( isa => 'Int', is => 'ro', lazy => 1, default => sub { my $self = shift; return get_role_from_name( $self->role_name ); }, ); has 'role_name' => ( isa => 'Str', is => 'ro', lazy => 1, default => sub { my $self = shift; return get_role_name( $self->role ); }, ); sub BUILD { my $self = shift; # check role if ( ! exists $self->{'role'} and ! exists $self->{'role_name'} ) { die "Role information is missing"; } return; } 1; __END__