X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStorage%2FBasic.pm;h=58cd6a30085baf61ea41f1c2178c31cb26c776c4;hb=81a523ba27fe312e8d52f275283a892542f79f68;hp=4cc747f123fbb56a9e0c7bd1a6fabaad402c25db;hpb=1f5c6dd8f93eeac19200d0b3ad36d33e5065f53b;p=gitmo%2FMooseX-Storage.git diff --git a/lib/MooseX/Storage/Basic.pm b/lib/MooseX/Storage/Basic.pm index 4cc747f..58cd6a3 100644 --- a/lib/MooseX/Storage/Basic.pm +++ b/lib/MooseX/Storage/Basic.pm @@ -2,8 +2,9 @@ package MooseX::Storage::Basic; use Moose::Role; use MooseX::Storage::Engine; +use String::RewritePrefix; -our $VERSION = '0.25'; +our $VERSION = '0.33'; our $AUTHORITY = 'cpan:STEVAN'; sub pack { @@ -25,20 +26,23 @@ sub unpack { sub _storage_get_engine_class { my ($self, %args) = @_; - my $default = 'MooseX::Storage::Engine'; - - return $default + return 'MooseX::Storage::Engine' unless ( exists $args{engine_traits} && ref($args{engine_traits}) eq 'ARRAY' && scalar(@{$args{engine_traits}}) ); - my @roles = map { sprintf("%s::Trait::%s", $default, $_) } - @{$args{engine_traits}}; + my @roles = String::RewritePrefix->rewrite( + { + '' => 'MooseX::Storage::Engine::Trait::', + '+' => '', + }, + @{$args{engine_traits}} + ); Moose::Meta::Class->create_anon_class( - superclasses => [$default], + superclasses => ['MooseX::Storage::Engine'], roles => [ @roles ], cache => 1, )->name;