X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FBit%2FMorseSignals%2FEmitter.pm;h=7e11c1dbe66f1865bb9343af5eebaf5f0bb6959e;hb=68eb455d71803aa45fd67f97c9dd628fff59e1c4;hp=54249f2975061998924866f74fa134791c2eaf4c;hpb=d4cad38280f090c2057f4df1d6ef1fce88ccbcc6;p=perl%2Fmodules%2FBit-MorseSignals.git diff --git a/lib/Bit/MorseSignals/Emitter.pm b/lib/Bit/MorseSignals/Emitter.pm index 54249f2..7e11c1d 100644 --- a/lib/Bit/MorseSignals/Emitter.pm +++ b/lib/Bit/MorseSignals/Emitter.pm @@ -3,11 +3,11 @@ package Bit::MorseSignals::Emitter; use strict; use warnings; -use Carp qw/croak/; -use Encode qw/encode_utf8 is_utf8/; -use Storable qw/freeze/; +use Carp qw; +use Encode qw; +use Storable qw; -use Bit::MorseSignals qw/:consts/; +use Bit::MorseSignals qw<:consts>; =head1 NAME @@ -15,17 +15,17 @@ Bit::MorseSignals::Emitter - Base class for Bit::MorseSignals emitters. =head1 VERSION -Version 0.06 +Version 0.08 =cut -our $VERSION = '0.06'; +our $VERSION = '0.08'; =head1 SYNOPSIS use Bit::MorseSignals::Emitter; - my $deuce = new Bit::MorseSignals::Emitter; + my $deuce = Bit::MorseSignals::Emitter->new; $deuce->post("hlagh") for 1 .. 3; while (defined(my $bit = $deuce->pop)) { sends_by_some_mean_lets_say_signals($bit); @@ -64,6 +64,8 @@ sub _count_bits { =head2 C + my $bme = Bit::MorseSignals::Emitter->new; + L object constructor. Currently does not take any optional argument. =cut @@ -81,7 +83,9 @@ sub new { return $self; } -=head2 C<< post $msg, < type => $type > >> +=head2 C + + $bme->post($msg, type => $type); Adds C<$msg> to the message queue and, if no other message is currently processed, dequeue the oldest item and prepare it. The type is automatically chosen, but you may want to try to force it with the C option : C<$type> is then one of the C constants listed in L @@ -102,7 +106,7 @@ sub post { # BM_DATA_{PLAIN, UTF8, STORABLE} $type = BM_DATA_AUTO unless defined $type and exists $manglers[$type]; if (ref $msg) { - return if { map { $_ => 1 } qw/CODE GLOB/ }->{ref $msg}; + return if { map { $_ => 1 } qw }->{ref $msg}; $type = BM_DATA_STORABLE; } elsif ($type == BM_DATA_AUTO) { $type = is_utf8($msg) ? BM_DATA_UTF8 : BM_DATA_PLAIN; @@ -210,7 +214,7 @@ sub reset { my ($self) = @_; _check_self($self); $self->{state} = @{$self->{queue}} > 0; - @{$self}{qw/buf len pos/} = (); + @{$self}{qw} = (); return $self; } @@ -267,7 +271,7 @@ L, L. Vincent Pit, C<< >>, L. -You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince). +You can contact me by mail or on C (vincent). =head1 BUGS