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::Basename - Parsing File Path into Directory and Base Name.

Description

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

This class parses a file path into a directory and a base name.

Usage

  use File::Basename;
  
  my $path = "dir/a.txt";
  
  # fileparse
  {
    my $ret =File::Basename->fileparse($path);
    
    # a.txt
    my $base_name = $ret->[0];
    
    # dir/
    my $dir_name = $ret->[1];
  }
  
  # basename
  {
    # a.txt
    my $base_name =File::Basename->basename($path);
  }

  # dirname
  {
    # dir
    my $dir_name =File::Basename->dirname($path);
  }

Interfaces

Class Methods

fileparse

  static method fileparse : string[] ($path : string);

basename

  static method basename : string ($path : string);

dirname

  static method dirname : string ($path : string);

Object Oriented Classes

File::Basename is implemented using the following classes.

File::Basename::Instance::Unix
File::Basename::Instance::Win32

See Also

File::Basename

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

Repository

SPVM::File::Basename - 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.