Syntax::Feature::Gather - Provide a gather keyword


Syntax-Keyword-Gather documentation Contained in the Syntax-Keyword-Gather distribution.

Index


Code Index:

NAME

Top

Syntax::Feature::Gather - Provide a gather keyword

VERSION

Top

version 1.001000

SYNOPSIS

Top

 use syntax 'gather';

 my @list = gather {
    # Try to extract odd numbers and odd number names...
    for (@data) {
       if (/(one|three|five|seven|nine)$/) { take qq{'$_'} }
       elsif (/^\d+$/ && $_ %2)            { take $_ }
    }
    # But use the default set if there aren't any of either...
    take @defaults unless gathered;
 }

or to use the stuff that Sub::Exporter gives us, try

 # this is a silly idea
 use syntax gather => {
   gather => { -as => 'bake' },
   take   => { -as => 'cake' },
 };

 my @vals = bake { cake (1...10) };

The full documentation for this module is in Syntax::Keyword::Gather. This is just a way to use the sugar that syntax gives us.

AUTHORS

Top

COPYRIGHT AND LICENSE

Top


Syntax-Keyword-Gather documentation Contained in the Syntax-Keyword-Gather distribution.

package Syntax::Feature::Gather;
BEGIN {
  $Syntax::Feature::Gather::VERSION = '1.001000';
}

use strict;
use warnings;

# ABSTRACT: Provide a gather keyword

use Syntax::Keyword::Gather ();

sub install {
  my ($class, %args) = @_;

  my $target  = $args{into};
  my $options = $args{options} || {};

  Syntax::Keyword::Gather->import({ into => $target }, %$options );

  return 1;
}

1;



__END__