diff --git a/.travis.yml b/.travis.yml index 6522bb2a..73336583 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,5 @@ cache: - /home/travis/perl5/perlbrew/perls/5.20/lib/site_perl - /home/travis/perl5/perlbrew/perls/5.16/lib/site_perl before_install : - - cpanm -f Data::UUID::LibUUID # - sudo apt-get install libuuid1 uuid-dev raptor2-utils diff --git a/Build.PL b/Build.PL index 4c25bdf2..091d8ad3 100644 --- a/Build.PL +++ b/Build.PL @@ -55,7 +55,7 @@ my $builder = Module::Build::Database->new( 'YAML::Syck' => 0, 'YAML::XS' => 0, 'YAML' => 0, - 'Data::UUID::LibUUID' => 0, + 'UUID::Tiny' => 0, 'Rose::DB' => '0.772', 'Rose::DB::Object' => 0, 'DBD::Pg' => '3.003', diff --git a/lib/Tuba.pm b/lib/Tuba.pm index d5bd0925..5ee7456b 100644 --- a/lib/Tuba.pm +++ b/lib/Tuba.pm @@ -61,8 +61,7 @@ use Mojo::Base qw/Mojolicious/; use Mojo::ByteStream qw/b/; use Tuba::Converter; use Tuba::Log; -use Tuba::Util qw/set_config/; -use Data::UUID::LibUUID; +use Tuba::Util qw/set_config new_uuid/; use Path::Class qw/file/; use strict; @@ -277,9 +276,9 @@ sub startup { return $c->render( text => "sorry, max is 1000 at once" ) if $count > 1000; $c->res->headers->content_type('text/plain'); $c->respond_to( - text => sub { shift->render( text => ( join "\n", (map new_uuid_string(4), 1..$count) ) ) }, - html => sub { shift->render( text => ( join "\n", (map new_uuid_string(4), 1..$count) ) ) }, - json => sub { shift->render( json => [ map new_uuid_string(4), 1..$count ] ) }, + text => sub { shift->render( text => ( join "\n", (map new_uuid(), 1..$count) ) ) }, + html => sub { shift->render( text => ( join "\n", (map new_uuid(), 1..$count) ) ) }, + json => sub { shift->render( json => [ map new_uuid(), 1..$count ] ) }, ); } => 'uuid' ); diff --git a/lib/Tuba/Array.pm b/lib/Tuba/Array.pm index a730d064..7ab2ab2f 100644 --- a/lib/Tuba/Array.pm +++ b/lib/Tuba/Array.pm @@ -12,7 +12,7 @@ use Path::Class qw/file dir/; use File::Basename qw/basename/; use Tuba::Log; use Tuba::DB::Objects qw/-nicknames/; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use Text::CSV_XS; =head1 ROUTES @@ -73,7 +73,7 @@ sub update_rel { sub create_form { my $c = shift; - $c->param(identifier => new_uuid_string(4)); + $c->param(identifier => new_uuid()); $c->stash(controls => { rows => { template => 'grid' } }); diff --git a/lib/Tuba/Controller.pm b/lib/Tuba/Controller.pm index 2a0a9048..6b3e3f2a 100644 --- a/lib/Tuba/Controller.pm +++ b/lib/Tuba/Controller.pm @@ -13,11 +13,10 @@ use Tuba::Search; use Pg::hstore qw/hstore_encode hstore_decode/; use Path::Class qw/file/; use Tuba::Log; -use Tuba::Util qw/nice_db_error show_diffs/; +use Tuba::Util qw/nice_db_error show_diffs human_duration/; use File::Temp; use YAML qw/Dump/; use Encode qw/encode decode/; -use Tuba::Util qw/human_duration/; use Mojo::Util qw/camelize decamelize/; use LWP::UserAgent; use HTTP::Request; diff --git a/lib/Tuba/DB/Mixin/Object/Activity.pm b/lib/Tuba/DB/Mixin/Object/Activity.pm index d84c58e6..e5d606b4 100644 --- a/lib/Tuba/DB/Mixin/Object/Activity.pm +++ b/lib/Tuba/DB/Mixin/Object/Activity.pm @@ -1,10 +1,10 @@ package Tuba::DB::Object::Activity; # Tuba::DB::Mixin::Object::Activity -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use strict; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); sub stringify { diff --git a/lib/Tuba/DB/Mixin/Object/Array.pm b/lib/Tuba/DB/Mixin/Object/Array.pm index 129e3b34..37d0ff48 100644 --- a/lib/Tuba/DB/Mixin/Object/Array.pm +++ b/lib/Tuba/DB/Mixin/Object/Array.pm @@ -1,12 +1,12 @@ package Tuba::DB::Object::Array; # Tuba::DB::Mixin::Object::Array; use Mojo::ByteStream qw/b/; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use List::Util qw/max/; use strict; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); sub stringify { diff --git a/lib/Tuba/DB/Mixin/Object/Book.pm b/lib/Tuba/DB/Mixin/Object/Book.pm index 5705771f..f4cbb18c 100644 --- a/lib/Tuba/DB/Mixin/Object/Book.pm +++ b/lib/Tuba/DB/Mixin/Object/Book.pm @@ -1,10 +1,10 @@ package Tuba::DB::Object::Book; # Tuba::DB::Mixin::Object::Book -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use strict; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); diff --git a/lib/Tuba/DB/Mixin/Object/File.pm b/lib/Tuba/DB/Mixin/Object/File.pm index 50864960..b5aadf37 100644 --- a/lib/Tuba/DB/Mixin/Object/File.pm +++ b/lib/Tuba/DB/Mixin/Object/File.pm @@ -2,7 +2,7 @@ package Tuba::DB::Object::File; # Tuba::DB::Mixin::Object::File; use Mojo::ByteStream qw/b/; use Mojo::Parameters; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use Path::Class (); use Tuba::Log qw/logger/; use Tuba::Util qw/get_config/; @@ -11,7 +11,7 @@ use Path::Class (); use strict; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); our %typeMap = ( diff --git a/lib/Tuba/DB/Mixin/Object/Generic.pm b/lib/Tuba/DB/Mixin/Object/Generic.pm index cac4beaa..4331e96d 100644 --- a/lib/Tuba/DB/Mixin/Object/Generic.pm +++ b/lib/Tuba/DB/Mixin/Object/Generic.pm @@ -1,6 +1,6 @@ package Tuba::DB::Object::Generic; # Tuba::DB::Mixin::Object::Generic; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use Pg::hstore; use Encode; use strict; @@ -18,7 +18,7 @@ __PACKAGE__->meta->column('attrs')->add_trigger( }); __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); diff --git a/lib/Tuba/DB/Mixin/Object/Image.pm b/lib/Tuba/DB/Mixin/Object/Image.pm index 7d517625..13687a7b 100644 --- a/lib/Tuba/DB/Mixin/Object/Image.pm +++ b/lib/Tuba/DB/Mixin/Object/Image.pm @@ -1,9 +1,9 @@ package Tuba::DB::Object::Image; # Tuba::DB::Mixin::Object::Image; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); sub stringify { diff --git a/lib/Tuba/DB/Mixin/Object/ModelRun.pm b/lib/Tuba/DB/Mixin/Object/ModelRun.pm index 43b0b391..e86cf6f5 100644 --- a/lib/Tuba/DB/Mixin/Object/ModelRun.pm +++ b/lib/Tuba/DB/Mixin/Object/ModelRun.pm @@ -1,9 +1,9 @@ package Tuba::DB::Object::ModelRun; # Tuba::DB::Mixin::Object::ModelRun; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); 1; diff --git a/lib/Tuba/DB/Mixin/Object/Webpage.pm b/lib/Tuba/DB/Mixin/Object/Webpage.pm index 8c683f47..11af6343 100644 --- a/lib/Tuba/DB/Mixin/Object/Webpage.pm +++ b/lib/Tuba/DB/Mixin/Object/Webpage.pm @@ -1,10 +1,10 @@ package Tuba::DB::Object::Webpage; # Tuba::DB::Mixin::Object::Webpage -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; use strict; __PACKAGE__->meta->primary_key_generator(sub { - return new_uuid_string(4); + return new_uuid(); }); diff --git a/lib/Tuba/Image.pm b/lib/Tuba/Image.pm index 8786504f..b6531069 100644 --- a/lib/Tuba/Image.pm +++ b/lib/Tuba/Image.pm @@ -12,7 +12,7 @@ use Path::Class qw/file dir/; use File::Basename qw/basename/; use Tuba::Log; use Tuba::DB::Objects qw/-nicknames/; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; =head1 ROUTES @@ -72,7 +72,7 @@ sub update_rel { sub create_form { my $c = shift; - $c->param(identifier => new_uuid_string(4)); + $c->param(identifier => new_uuid()); return $c->SUPER::create_form(@_); } diff --git a/lib/Tuba/Reference.pm b/lib/Tuba/Reference.pm index e4b98381..ec976540 100644 --- a/lib/Tuba/Reference.pm +++ b/lib/Tuba/Reference.pm @@ -9,7 +9,7 @@ use Mojo::Base qw/Tuba::Controller/; use Tuba::DB::Objects qw/-nicknames/; use Rose::DB::Object::Util qw/:all/; use Tuba::Log qw/logger/;; -use Data::UUID::LibUUID; +use Tuba::Util qw[new_uuid]; sub list { my $c = shift; @@ -349,7 +349,7 @@ sub set_title { sub create_form { my $c = shift; - $c->param(identifier => new_uuid_string(4)); + $c->param(identifier => new_uuid()); return $c->SUPER::create_form(@_); } diff --git a/lib/Tuba/Util.pm b/lib/Tuba/Util.pm index 1ec843d1..15dd2d88 100644 --- a/lib/Tuba/Util.pm +++ b/lib/Tuba/Util.pm @@ -11,8 +11,9 @@ use Mojo::ByteStream qw/b/; use Mojo::Util qw/xml_escape/; use Encode qw/decode/; use DateTime::Format::Human::Duration; +use UUID::Tiny qw/:std/; -our @EXPORT_OK = qw/nice_db_error set_config get_config show_diffs elide_str human_duration/; +our @EXPORT_OK = qw/nice_db_error set_config get_config show_diffs elide_str human_duration new_uuid/; sub nice_db_error { my $err = shift or return; @@ -60,5 +61,9 @@ sub human_duration { return DateTime::Format::Human::Duration->new()->format_duration($d); } +sub new_uuid { + return create_uuid_as_string(UUID_V4); +} + 1;