Name

SPVM::File::Find - Finding Files in Subdirectories

Description

File::Find class in SPVM has methods to find files in subdirectories.

Warnings:

Many tests are not written yet. This class has many bugs.

Usage

use File::Find;

my $dir = "lib";

File::Find->new->find(method : void ($info : File::Find::Info) {
  
  my $dir = $info->dir;
  
  my $file_name = $info->name;
  
}, $top_dir);

Gets file names:

use File::Find;
use StringList;

my $dir = "lib";

my $files_list = StringList->new;

File::Find->new->find([$files_list : StringList] method : void ($info : File::Find::Info) {
  my $file_name = $info->name;
  
  $files_list->push($file_name);
}, $top_dir);

my $files = $files_list->to_array;

Fields

bydepth

has bydepth : ro byte;

preprocess

has preprocess : ro File::Find::Callback::Preprocess;

postprocess

has postprocess : ro File::Find::Callback;

follow

has follow : ro byte;

follow_fast

has follow_fast : ro byte;

follow_skip

has follow_skip : ro byte;

has dangling_symlinks : ro File::Find::Callback::DanglingSymlinks;

no_chdir

has no_chdir : ro byte;

has dont_use_nlink : ro byte;

warn

has warn : ro byte;

Class Methods

new

static method new : File::Find ($options : object[] = undef);

Creates a new File::Find object given the options $options, and returns the new object.

Options:

Instance Methods

method find : void ($cb : File::Find::Callback, $dir : string);

Iterates each file recursively under the $dir and calls the callback $cb by the file.

Porting

SPVM::File::Find is a Perl's File::Find porting to SPVM.

Repository

SPVM::File::Find - Github

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License