Parse-Eyapp
view release on metacpan or search on metacpan
lib/Parse/Eyapp/Base.pm view on Meta::CPAN
lastval
part
);
our %EXPORT_TAGS = ( 'all' => [ @EXPORT_OK ] );
}
use base qw(Exporter);
our $FILENAME=__FILE__;
sub firstval(&@) {
my $handler = shift;
return (grep { $handler->($_) } @_)[0]
}
sub lastval(&@) {
my $handler = shift;
return (grep { $handler->($_) } @_)[-1]
}
# Receives a handler $h and a list @_
# Elements of @_ with the same value of $h go to the same sublist
# Returns a list of lists
sub part(&@) {
my $h = shift;
my @p;
push @{$p[$h->($_)]}, $_ for (@_);
return @p;
}
####################################################################
# Usage : $input = slurp_file($filename, 'trg');
# Purpose : opens "$filename.trg" and sets the scalar
lib/Parse/Eyapp/Node.pm view on Meta::CPAN
use strict;
use Carp;
no warnings 'recursion';
use Parse::Eyapp::YATW;
use List::Util qw(first);
use Data::Dumper;
our $FILENAME=__FILE__;
sub firstval(&@) {
my $handler = shift;
return (grep { $handler->($_) } @_)[0]
}
sub lastval(&@) {
my $handler = shift;
return (grep { $handler->($_) } @_)[-1]
}
####################################################################
# Usage :
# line: %name PROG
# exp <%name EXP + ';'>
# { @{$lhs->{t}} = map { $_->{t}} ($lhs->child(0)->children()); }
lib/Parse/Eyapp/YATW.pm view on Meta::CPAN
# (c) Parse::Eyapp Copyright 2006-2008 Casiano Rodriguez-Leon, all rights reserved.
package Parse::Eyapp::YATW;
use strict;
use warnings;
use Carp;
use Data::Dumper;
use List::Util qw(first);
sub firstval(&@) {
my $handler = shift;
return (grep { $handler->($_) } @_)[0]
}
sub lastval(&@) {
my $handler = shift;
return (grep { $handler->($_) } @_)[-1]
}
sub valid_keys {
my %valid_args = @_;
my @valid_args = keys(%valid_args);
local $" = ", ";
( run in 0.820 second using v1.01-cache-2.11-cpan-94b05bcf43c )