package PIMYGC::Types::Library; use MooseX::Types -declare => [ qw( GoogleUrlId ) ]; use MooseX::Types::Moose qw/HashRef Str/; subtype GoogleUrlId, as HashRef[Str], where { $_ =~ m/\/([0-9a-z]+)$/xms }; coerce GoogleUrlId, from Str, via { my ($id) = $_ =~ m/\/([0-9a-z]+)$/xms; { full => $_, id => $id, } };