johnnywang has asked for the wisdom of the Perl Monks concerning the following question:

while I was looking at the source of POE::Driver::SysRW, I saw the line: {% use_bytes %}, what is the syntax? what does it mean? Thanks. The full method is as follows:
sub put { my ($self, $chunks) = @_; my $old_queue_octets = $self->[TOTAL_OCTETS_LEFT]; {% use_bytes %} foreach (grep { length } @$chunks) { $self->[TOTAL_OCTETS_LEFT] += length; push @{$self->[OUTPUT_QUEUE]}, $_; } if ($self->[TOTAL_OCTETS_LEFT] && (!$old_queue_octets)) { $self->[CURRENT_OCTETS_LEFT] = length($self->[OUTPUT_QUEUE]->[0]); $self->[CURRENT_OCTETS_DONE] = 0; } $self->[TOTAL_OCTETS_LEFT]; }

Replies are listed 'Best First'.
Re: What is: {% use_bytes %}?
by bmann (Priest) on Mar 30, 2005 at 00:10 UTC
    It is a POE::Preprocessor directive.

    It's POE's way to use bytes; if the bytes pragma exists, or to fail gracefully if it does not exist (pre 5.6, IIRC).

    Update: You find

    use POE::Preprocessor ( isa => "POE::Macro::UseBytes" );
    early on in the source of POE::Driver::SysRW, but for some reason POE::Macro::UseBytes is not indexed by CPAN. Download the source of POE if you want to see UseBytes.pm
Re: What is: {% use_bytes %}?
by ambs (Pilgrim) on Mar 30, 2005 at 08:07 UTC
    The POE code is filtered?

    Alberto Simões