[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] from homebrew objects to Moose
Tonight I'm moving a bunch of classes from our homebrew object system to
use Moose instead. Below is a sample svn diff.
Moose: http://search.cpan.org/~stevan/Moose/lib/Moose.pm
j
party king! :)
use strict;
-use Base;
-use vars qw(@ISA @ATT);
-@ISA = qw( Base );
-@ATT = qw( );
+use Moose;
+extends 'Omni2::Base';
+ # My current buffer. Is left blank for TCP* buffers.
+has buffer => ( is => 'rw', isa => 'Str' );
+has c_mux => ( is => 'rw', isa => 'HashRef' ); # Omni2::Control::Multiplex object
+has label => ( is => 'rw', isa => 'Str' ); # What people call me
+has mode => ( is => 'rw', isa => 'Str' ); # read? write? (both?)
+has fh => ( is => 'rw', isa => 'FileHandle' ); # My read/write filehandle
+no Moose;
-{
- my %_attr_data = (
- # My current buffer. Is left blank for TCP* buffers.
- buffer => ['1', 'RW', 'attr', 'O','is_string', ''],
- c_mux => ['2', 'RW', 'attr', 'R','is_hash', ''], # Omni2::Control::Multiplex object
- label => ['3', 'RW', 'attr', 'R','is_string', ''], # What people call me
- mode => ['4', 'RW', 'attr', 'R','is_string', ''], # read? write? (both?)
- fh => ['5', 'RW', 'attr', 'R','is_glob', ''], # My read/write filehandle
- );
- sub get_attr_data_ref { return \%_attr_data; }
- sub get_ATT { return @ATT; }
-}