Data-Domain
view release on metacpan or search on metacpan
lib/Data/Domain.pm view on Meta::CPAN
my ($self, $msg_id, @args) = @_;
my $msgs = $self->{-messages};
my $name = $self->name;
# if using a coderef, these args will be passed to it
my @msgs_call_args = ($name, $msg_id, @args);
shift @msgs_call_args if $USE_OLD_MSG_API; # because older versions did not pass the $name arg
# perl v5.22 and above warns if there are too many @args for sprintf.
# The line below prevents that warning
no if $] ge '5.022000', warnings => 'redundant';
# if there is a user-defined message, return it
if (defined $msgs) {
for (ref $msgs) {
/^CODE/ and return $msgs->(@msgs_call_args); # user function
/^$/ and return "$name: $msgs"; # user constant string
/^HASH/ and do { if (my $msg_string = $msgs->{$msg_id}) { # user hash of msgs
return sprintf "$name: $msg_string", @args;
}
else {
( run in 0.604 second using v1.01-cache-2.11-cpan-cc502c75498 )