Cool tricks with AT codes

Inside the Text state

Text is probably the simplest state:

Set up the parentage, and add some accessors

 use strict;
 package Device::Ericsson::AccessoryMenu::Text;
 use base 'Device::Ericsson::AccessoryMenu::State';
 __PACKAGE__->mk_accessors( qw( title lines ) );

on_enter we just send the dialog over

 sub on_enter {
     my $self = shift;
     my $title = $self->title;
     $self->send( join ',',
                  qq{AT*EAID=14,2,"$title"},
                  map { qq{"$_"} } @{ $self->lines }
                 );
     $self->expect( 'OK' );
 }

And whatever value our handler gets, it means leave this state

 sub handle {
     my $self = shift;
     $self->exit_state;
 }
 
 1;

That's all there is to it.