The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::File::Find - Short Description

Description

SPVM::File::Find is the File::Find class in SPVM language.

The File::Find class has methods to get files under a directory.

Usage

  use File::Find;
  
  my $dir = "lib";
  
  my $files_list = StringList->new;
  
  File::Find->find([$files_list : StringList] method : void ($dir : string, $file_base_name : string) {
    my $file = $dir;
    if ($file_base_name) {
      $file .= "/$file_base_name";
    }
    
    warn "$file";
  }, $dir);

Gets file names:

  use File::Find;
  use StringList;
  
  my $dir = "lib";
  
  my $files_list = StringList->new;
  
  File::Find->find([$files_list : StringList] method : void ($dir : string, $file_base_name : string) {
    my $file = $dir;
    if ($file_base_name) {
      $file .= "/$file_base_name";
    }
    
    $files_list->push($file);
    
  }, $dir);
  
  my $files = $files_list->to_array;

Class Methods

  static method find : void ($cb : File::Find::Handler, $top_dir : string, $options = undef : object[]);

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

See also

File::Find

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 2023-2023 Yuki Kimoto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.