NAME
String::FilenameStatic - Static functions to manipulate a filename and path.
SYNOPSIS
# imports all functions
# imports only two functions
DESCRIPTION
This class provides static functions which can be imported to the namespace of the current class.
REQUIRES
METHODS
get_file
my
$string
= get_file(
$string
);
Extracts the whole filename without the path
get_file(
'/etc/webserver/httpd.conf'
);
# writes: 'httpd.conf'
get_file_extension
my
$string
= get_file_extension(
$string
);
Extracts the extension of a filename
get_filename(
'/etc/webserver/httpd.conf'
);
# writes: 'conf'
get_filename
my
$string
= get_filename(
$string
);
Extracts the whole filename without the path
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.
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.