NAME
MooseX::RW - Moose::Role reader/writer
VERSION
version 0.003
SYNOPSIS
Let suppose you have a voice box on you phone. You want to display all number of your messages.
package VoiceBox::Reader;
use Moose;
use Phone;
with MooseX::RW::Reader;
# VoIP phone
has phone => ( is => 'rw', isa => 'Phone', required => 1 );
sub read {
my $self = shift;
my $vb = $phone->voicebox;
my $count = $self->count;
return if $vb->count >= $count;
my $msg = $phone->voicebox->get_msg($count);
$self->count($count+1);
return $msg;
}
package Main;
my $phone = Phone->new( url => 'a.b.c.d' );
my $reader = VoiceBox::Reader->new( phone => $phone );
while ( $msg = $reader->read() ) {
say $msg->count, ": ", $msg->from;
}
ATTRIBUTES
count
Count of items/records which have been handled by reader/writer.
METHODS
begin
Not required method which could be called by a processor at the begining of a process.
end
Not required method which could be called by a processor at the end of a process.
AUTHOR
Frédéric Demians <f.demians@tamil.fr>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Fréderic Démians.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007