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

Description

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

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

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);
  }

Interfaces

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);

has_interfaces

  method has_interfaces : int ();

Returns 1.

Well Known Child Classes

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

Repository

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