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

The File::Basename class of SPVM has the methods to parse a file path into the directory part and the base name part.

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 (c) 2023 Yuki Kimoto

MIT License