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::Instance - Object-Oriented File::Basename

Description

The SPVM::File::Basename::Instance class of SPVM has the methods for Object-Oriented File::Basename.

Usage

use File::Basename::Instance;

my $fb = File::Basename::Instance->new;

my $path = "dir/a.txt";

# fileparse
{
  my $ret = $fb->fileparse($path);
  
  # a.txt
  my $base_name = $ret->[0];
  
  # dir/
  my $dir_name = $ret->[1];
}

# basename
{
  # a.txt
  my $base_name = $fb->basename($path);
}

# dirname
{
  # dir
  my $dir_name = $fb->dirname($path);
}

Class Methods

new

static method new : File::Basename::Instance ();

Instance Methods

fileparse

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

basename

method basename : string ($path : string);

dirname

method dirname : string ($path : string);

Well Known Child Classes

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

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License