MooseX::RW - Moose::Role reader/writer
version 0.003
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; }
Count of items/records which have been handled by reader/writer.
Not required method which could be called by a processor at the begining of a process.
Not required method which could be called by a processor at the end of a process.
Frédéric Demians <f.demians@tamil.fr>
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
To install MooseX::RW, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::RW
CPAN shell
perl -MCPAN -e shell install MooseX::RW
For more information on module installation, please visit the detailed CPAN module installation guide.