Name
Data::Unique::Name - Generate a unique but stable name from a string
Synopsis
use Data::Unique::Name;
my $u = Data::Unique::Name::new(4);
ok $u->generateUniqueName("aaaa") eq "aaaa";
ok $u->generateUniqueName("aaaa") eq "aaaa1";
ok $u->generateUniqueName("aaaa1") eq "aaaa2";
ok $u->generateUniqueName("aaaa2") eq "aaaa3";
ok $u->generateUniqueName("aaaab") eq "aaaa4";
ok $u->generateUniqueName("a a a a b") eq "aaaa5";
ok $u->generateUniqueName("a-a(a)/ab") eq "aaaa6";
ok $u->generateUniqueName("bbbbb") eq "bbbb";
ok $u->generateUniqueName("bbbbbb") eq "bbbb1";
ok $u->generateUniqueName("bbbbbbb") eq "bbbb2";
Description
Constructor
new
Construct a new set of unique names
1 $length Maximum length of generated names # File name to be used on S3
Methods
generateUniqueName
Generate a unique name corresponding to a string
1 $set Set of unique strings
2 $string String
Index
Installation
This module is written in 100% Pure Perl and, thus, it is easy to read, use, modify and install.
Standard Module::Build process for building and installing modules:
perl Build.PL
./Build
./Build test
./Build install
Author
Copyright
Copyright (c) 2016-2017 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.