diff options
author | Andy Shevchenko <andy@smile.org.ua> | 2012-07-29 08:47:33 +0000 |
---|---|---|
committer | Andy Shevchenko <andy@smile.org.ua> | 2012-07-29 08:47:33 +0000 |
commit | 388814857c45c9076d88da6eb89c7180e9b7dbfd (patch) | |
tree | 03f46eeda6585286e16fdfd1bc3b18d2f94f0252 /lib | |
parent | d7282126855b13df51fab62b97f50678cbfd4d41 (diff) | |
download | renrot-388814857c45c9076d88da6eb89c7180e9b7dbfd.tar.gz renrot-388814857c45c9076d88da6eb89c7180e9b7dbfd.tar.bz2 |
fileutil: introduce splitext() to get base and extension of filename
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
git-svn-id: file:///svnroot/renrot/trunk@618 fe2816f4-e837-0410-b10a-f608c9d244a1
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Image/RenRot/FileUtil.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Image/RenRot/FileUtil.pm b/lib/Image/RenRot/FileUtil.pm index 472fbf0..320aee7 100644 --- a/lib/Image/RenRot/FileUtil.pm +++ b/lib/Image/RenRot/FileUtil.pm @@ -15,7 +15,7 @@ use Image::RenRot::Logging; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); -@EXPORT = qw(makedir); +@EXPORT = qw(makedir splitext); ######################################################################################## # @@ -150,5 +150,12 @@ sub piper { return join("", @piped_arr); } +sub splitext { + my $filename = shift; + + return ($1, $2) if ($filename =~ m/(.*)\.([^\/\.]+)$/); + return ($filename, ""); +} + ######################################################################################## 1; # end |