package GSM::Cell; use Moose; use MooseX::AttributeHelpers; use Data::Dumper; has 'BCCH' => (is => 'rw', lazy => 1, default => &set_bcch); has 'LAC' => (is => 'ro', required => 1); has 'CI' => (is => 'ro', required => 1); has 'NAME' => (is => 'rw', lazy => 1, default => &set_name); has 'ID' => (is => 'ro', lazy => 1, default => \&set_id); with qw(SQLConnection); sub set_id { my $self = shift; return join(',',$self->LAC,$self->CI); } sub set_bcch { my $self = shift; my $sth = $self->dbh->prepare('select BCCHFrequency from Cell where CI = ? and LAC = ?); $sth->execute($self->CI,$self->LAC); return $sth->fetchrow_array; } sub set_name { my $self = shift; my $sth = $self->dbh->prepare('select UserLabel from Cell where CI = ? and LAC = ?'); $sth->execute($self->CI,$self->LAC); return $sth->fetchrow_array; } no Mouse; __PACKAGE__->meta->make_immutable; 1; #so the 'require' or 'use' succeeds