FunctionalPerl

 view release on metacpan or  search on metacpan

examples/hiring-without-whiteboards  view on Meta::CPAN

    my ($name, $url, $rest) = $s =~ /^\[(.*?)\] *\((.*?)\)\s*(.*)$/
        or die "missing link formatting in: '$s'";

    my @p = split /\s*\|\s*/, $rest;
    @p == 2 or @p == 3 or die "rest does not contain 2 or 3 parts: '$rest'";
    my (undef, $locations, $maybe_process) = @p;
    Company(
        $name, $url,

        # /, ; and & used inconsistently:
        list(map { parse_location $_ } split m%\s*[/;&]\s*%, $locations),
        $maybe_process
    )
}

TEST {
    parse_line
        "- [Accredible](https://www.accredible.com/careers) | Cambridge, UK / San Francisco, CA / Remote | Take home project, then a pair-programming and discussion onsite / Skype round."
}
Company(
    "Accredible",

lib/FP/Path.pm  view on Meta::CPAN

    ],
    'FP::Struct::Show',
    'FP::Abstract::Equal',
    'FP::Abstract::Pure';

*import = constructorexporter new_from_string => "path";

sub new_from_string {
    @_ == 2 or fp_croak_arity 2;
    my ($class, $str) = @_;
    my @p = split m{/+}, $str;
    shift @p if (@p and $p[0] eq "");
    $class->new(
        array_to_list_reverse(\@p),
        scalar $str =~ m{/$}s,
        scalar $str =~ m{^/}s
    )
}

sub FP_Equal_equal {
    @_ == 2 or fp_croak_arity 2;

meta/FunctionalPerl/Dependencies/ChjBin.pm  view on Meta::CPAN

# Calling out to the `which` utility apparently spams the terminal
# with messages even on some "GNU/Linux" distros. D'uh. So go full
# Perl. Don't want to depend on https://metacpan.org/pod/File::Which,
# and we don't need Windows support as chj-bin is Unix only (really
# Linux only?) anyway. (Should we return undef on non-Linux $^O? No,
# nobody should be installing chj-bin if it doesn't work? Not sure.)

sub _maybe_which {
    my ($str)  = @_;
    my ($prog) = $str =~ /^([\w_.-]+)\z/s or die "invalid progname '$str'";
    my $paths  = [grep { length $_ } split m{:}, $ENV{PATH} // ""];
    for my $path (@$paths) {
        my $progpath = "$path/$prog";
        return $progpath if (-f $progpath and -x _);
    }
    undef
}

my %which;

sub maybe_which;



( run in 0.714 second using v1.01-cache-2.11-cpan-71847e10f99 )