use strict;
#use warnings;
use utf8;
+use feature 'state';
use Encode qw(encode decode);
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# vX.Y.Z: X YYYZZZ
-$VERSION = 1.000009;
+$VERSION = 1.000010;
@ISA = qw(Exporter);
@EXPORT = ();
@EXPORT_OK = (
'url_query_encode', 'url_query_decode',
'split_url', 'join_url', 'merge_url',
'html_entity_encode_dec', 'html_entity_encode_hex', 'html_entity_encode_name', 'html_entity_decode',
- 'join_path',
+ 'join_path', 'make_temp_path'
);
%EXPORT_TAGS = ();
return $path;
}
+sub make_temp_path {
+ (my $dir, my $basename) = @_;
+
+ my $filename;
+ my $ext;
+ my $ind = rindex($basename, '.');
+ state $id = 0;
+
+ if ($ind >= 0) {
+ $filename = substr($basename, 0, $ind);
+ $ext = substr($basename, $ind);
+ }
+ else {
+ $filename = $basename;
+ $ext = '';
+ }
+ if ($filename ne '') {
+ $filename .= '.';
+ }
+ $filename .= $$ . '.' . $id . '.' . time() . $ext;
+ $id++;
+
+ return join_path('/', $dir, $filename);
+}
+
##################