Cantella-Store-UUID
view release on metacpan or search on metacpan
lib/Cantella/Store/UUID.pm view on Meta::CPAN
package Cantella::Store::UUID;
use Moose;
use Try::Tiny;
use Class::MOP;
use Data::GUID;
use File::Copy qw();
use Path::Class qw();
use Cantella::Store::UUID::Util '_mkdirs';
use MooseX::Types::Path::Class qw/Dir/;
use namespace::autoclean;
our $VERSION = '0.003003';
$VERSION = eval $VERSION;
has nest_levels => (
is => 'ro',
isa => 'Int',
required => 1,
);
has root_dir => (
is => 'ro',
isa => Dir,
coerce => 1,
required => 1
);
has file_class => (
is => 'ro',
isa => 'ClassName',
required => 1,
default => sub {
Class::MOP::load_class('Cantella::Store::UUID::File');
return 'Cantella::Store::UUID::File';
}
);
# File::Copy 2.10 introduced 'sub _eq' in lieu of a simple "$from eq $to" check
# to enable checking of whether strings _or_ refs were identical. However, this
# resulted in
#
# Argument "...." isn't numeric in numeric eq (==) at /usr/share/perl/5.10/File/Copy.pm line 70.
#
# this hack will implement File::Copy 2.13's version of 'sub _eq'
# 5.8.8 File::Copy 2.09 -- ok
# 5.9.5 File::Copy 2.10 -- broken
# 5.8.9 File::Copy 2.13 -- ok
# 5.10.0 File::Copy 2.11 -- broken
# 5.10.1 File::Copy 2.14 -- ok
if ($File::Copy::VERSION >= 2.10 && $File::Copy::VERSION <= 2.12) {
Class::MOP::Package->initialize('File::Copy')->add_package_symbol('&_eq' => sub {
my $Scalar_Util_loaded = eval q{ require Scalar::Util; require overload; 1 };
my ($from, $to) = map {
$Scalar_Util_loaded && Scalar::Util::blessed($_)
&& overload::Method($_, q{""})
? "$_"
: $_
} (@_);
return '' if ( (ref $from) xor (ref $to) );
return $from == $to if ref $from;
( run in 2.031 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )