NAME

String::FilenameStatic - Static functions to manipulate a filename and path.

SYNOPSIS

# imports all functions
use String::FilenameStatic ':all';

# imports only two functions
use String::FilenameStatic qw(get_path get_file);

DESCRIPTION

This class provides static functions which can be imported to the namespace of the current class.

REQUIRES

Exporter

METHODS

get_file

my $string = get_file($string);

Extracts the whole filename without the path

print get_file('/etc/webserver/httpd.conf');
# writes: 'httpd.conf'

get_file_extension

my $string = get_file_extension($string);

Extracts the extension of a filename

print get_filename('/etc/webserver/httpd.conf');
# writes: 'conf'

get_filename

my $string = get_filename($string);

Extracts the whole filename without the path

print get_filename('/etc/webserver/httpd.conf');
# writes: 'httpd'

Yes, it sounds very similar to get_file(), but I had no better idea to describe it without writing get_file_without_extension.

get_path

my $string = get_path($string);

Extracts the path of a filename.

print get_path('/etc/webserver/httpd.conf');
# writes: '/etc/webserver'

remove_trailing_slash

my $string = remove_trailing_slash($string);

Returns the path without a slash on the end. You can use it more than once, without doing something wrong to the same string.

AUTHOR

Andreas Hernitscheck ahernit(AT)cpan.org

LICENSE

You can redistribute it and/or modify it under the conditions of LGPL.