Mercurial > hg > Gears > Gears
view src/parallel_execution/lib/Gears/Util.pm @ 693:aeab4866ee36
defined separate_code_and_data_gear_after_parse test
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 21 Aug 2020 17:07:01 +0900 |
parents | 3d959f470c8b |
children | 8416928992fc |
line wrap: on
line source
package Gears::Util; use strict; use warnings; use Carp qw/croak/; use File::Find qw/find/; sub uniq { my $class = shift; my %seen; return grep { !$seen{$_}++ } @_; } sub file_checking { my ($class, $file_name) = @_; unless (-f $file_name) { croak "[ERROR] invalid filepath :$file_name\n"; } return $file_name; } sub slup { my ($class,$file) = @_; open my $fh, '<', $file; local $/; my $f = <$fh>; return $f; } sub find_cbc_sources_from_path { my ($class, $find_path) = @_; $find_path //= "."; my @files; find( { wanted => sub { push @files, $_ if /\.cbc/ }, no_chdir => 1 }, $find_path); return \@files; } sub find_headers_from_path { my ($class, $find_path) = @_; $find_path //= "."; my @files; find( { wanted => sub { push @files, $_ if /\.(?:h|dg)/ }, no_chdir => 1 }, $find_path); return \@files; } 1;