FindApp

 view release on metacpan or  search on metacpan

lib/FindApp/Object/State/Group/Class.pm  view on Meta::CPAN

sub dir_types() {
    return qw(allowed wanted found);
}

sub dir_field(_) {
    my($type) = @_;
    no strict "refs";
    return sibpackage("State::\U$type")->();
}

sub type_map(&@) {
    my $code = shift;
    return map { &$code } +dir_types, @_;
}

sub dir_fields() {
    my $fields = [ type_map{dir_field} ];
    return @$fields;
}

sub field_map(&@) {
    my $code = shift;
    return map { &$code } +dir_fields, @_;
}

use namespace::clean;

sub class { &ENTER_TRACE_2;
    my($self) = @_;
    return blessed($self) || $self;
}

lib/FindApp/Object/State/Group/State.pm  view on Meta::CPAN

sub dir_types() {
    return qw(allowed wanted found);
}

sub dir_field(_) {
    my($type) = @_;
    no strict "refs";
    return &{uc $type};
}

sub type_map(&@) {
    my $code = shift;
    return map { &$code } +dir_types, @_;
}

sub dir_fields() {
    my $fields = [ type_map{dir_field} ];
    return @$fields;
}

sub field_map(&@) {
    my $code = shift;
    return map { &$code } +dir_fields, @_;
}

use namespace::clean; 

################################################################

use pluskeys qw{
    NAME

lib/FindApp/Utils/List.pm  view on Meta::CPAN

    good_args(@_ == 2);
    my($aref, $bref) = @_;

    # worst case
    local $SIG{__WARN__} = sub {};

    my %seen = map { $_ => 1 }  grep {defined} @$bref;
    return grep { ! $seen{$_} } grep {defined} @$aref;
}

sub somedir_map(&@) {
    good_args(@_ > 0);
    my $code = shift;
    return map { &$code } @_;
}

sub subdir_map(&) {
    good_args(@_ == 1);
    my $code = shift;
    return somedir_map(\&$code, BLM);
}

sub alldir_map(&) {
    good_args(@_ == 1);
    my $code = shift;
    return somedir_map(\&$code, root => BLM);
}

#################################################################

for my $CONJ (qw(and or nor)) {
    function "commify_$CONJ" => sub {
        my $comma = "@_" =~ /,/ ? ";" : ",";

lib/FindApp/Utils/Package/Object.pm  view on Meta::CPAN

}

# Returns string, not object.
sub join($) :method {
    @_ == 2                     || subcroak "need one arg, not " . (@_-1);
    my $self = shift;
    my $separator = shift;
    return CORE::join($separator, $self->split);
}

sub map(&) :method {
    @_ == 2                     || subcroak "need one arg, not " . (@_-1);
    my($self, $code) = @_;
    $self->new(CORE::map(&$code, $self->split));
}

# Returns new object(s)? and leaves original untouched.
sub grep(&) :method {
    @_ == 2                     || subcroak "need one arg, not " . (@_-1);
    my($self, $code) = @_;
    CORE::grep(&$code, $self->split);
}

# Returns string, not object.
sub abbreviate(;$) :method {
    @_ <= 2                     || subcroak "need either one argument or none, not " . (@_-1) . " of them";
    my $self = shift;
    my $here = shift || 1;

lib/FindApp/Utils/Syntax.pm  view on Meta::CPAN

    ##print "$name\n";

    no strict   "refs";
    no warnings "redefine";

    subname( $name => $code);
            *$name =  $code;
    return \&$name;
}

sub case(&) {
    &case_fallthrough;
    no warnings "exiting";
    next SWITCH;
}

sub case_fallthrough(&) {
    my($case) = @_;
    &$case;
}

1;

=encoding utf8

=head1 NAME

t/lib/FindApp/Test/Utils.pm  view on Meta::CPAN

            for (substr($File::Find::name, 1+length($libdir))) {
                s= \.pm \z ==x          || die "no pm in $_";
                s= /       =::=gx; #    || die "no slash in $_";
                push @modules, $_;
            }
        } $libdir;
    }
    return sort_modules @modules;
}

sub find(&@) { 
    my($with, @where) = @_;
    @where = qw(.) unless @where;
    return File::Find::find($with, @where);
}

# This has to be its own thing so we don't accidentally 
# rely on something we're testing.  Otherwise we'd just
# use sort_packages() from FindApp::Utils::Package.
sub sort_modules(@) {
    my @modules = do {



( run in 1.463 second using v1.01-cache-2.11-cpan-49f99fa48dc )