Color-Library
view release on metacpan or search on metacpan
lib/Color/Library.pm view on Meta::CPAN
@dictionaries = @{ shift() } if ref $_[0] eq "ARRAY";
my $query_;
for my $query (@_) {
$query_ = $query;
my @dictionaries = @dictionaries;
if ($query =~ m/:/) {
# Looks like the query contains at least one dictionary id
my ($dictionaries, $name) = split m/:/, $query, 2;
unless (defined $name) {
$name = $dictionaries;
undef $dictionaries
}
@dictionaries = split m/,/, $dictionaries if defined $dictionaries;
$query_ = $name;
}
my $color;
for my $dictionary_id (@dictionaries) {
next unless my $dictionary = $self->dictionary($dictionary_id);
last if $color = $dictionary->color($query_);
}
push @colors, $color;
}
lib/Color/Library/Dictionary.pm view on Meta::CPAN
__PACKAGE__->mk_classdata($_) for qw/_self _compiled _color_list _index/;
=head1 NAME
Color::Library::Dictionary - Color dictionary for Color::Library
=cut
sub _register_dictionary {
my $module = my $class = shift;
my @module = split m/::/, $module;
my @parent_module = @module;
my $name = pop @parent_module;
@parent_module = qw/Color Library/ if @parent_module == 3; # Color::Library::Dictionary
my $parent_module = join "::", @parent_module;
{
no strict 'refs';
*{"$parent_module\::$name"} = sub {
return $module->_singleton;
};
( run in 0.798 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )