Acme-MetaSyntactic
view release on metacpan or search on metacpan
lib/Acme/MetaSyntactic.pm view on Meta::CPAN
}
}
sub new {
my ( $class, @args ) = ( @_ );
my $theme;
$theme = shift @args if @args % 2;
$theme = $Theme unless $theme; # same default everywhere
# defer croaking until name() is actually called
bless { theme => $theme, args => { @args }, meta => {} }, $class;
}
# CLASS METHODS
sub add_theme {
my $class = shift;
my %themes = @_;
for my $theme ( keys %themes ) {
croak "The theme $theme already exists!" if exists $META{$theme};
my @badnames = grep { !/^[a-z_]\w*$/i } @{$themes{$theme}};
lib/Acme/MetaSyntactic/List.pm view on Meta::CPAN
if (@{"$class\::List"}) {
push @$list, shuffle @{"$class\::List"} while @$list < $count;
}
}
splice( @$list, 0, $count );
}
sub new {
my $class = shift;
bless { cache => [] }, $class;
}
sub theme {
my $class = ref $_[0] || $_[0];
no strict 'refs';
return ${"$class\::Theme"};
}
1;
lib/Acme/MetaSyntactic/Locale.pm view on Meta::CPAN
${"$_[0]::Separator"} = '_';
# call the parent class init code
goto &Acme::MetaSyntactic::MultiList::init;
}
sub new {
my $class = shift;
no strict 'refs';
my $self = bless { @_, cache => [] }, $class;
# compute some defaults
if( ! exists $self->{category} ) {
$self->{category} =
exists $self->{lang}
? $self->{lang}
: $ENV{LANGUAGE} || $ENV{LANG} || '';
if( !$self->{category} && $^O eq 'MSWin32' ) {
eval { require Win32::Locale; };
$self->{category} = Win32::Locale::get_language() unless $@;
lib/Acme/MetaSyntactic/MultiList.pm view on Meta::CPAN
if ( @{ $self->{base} } ) {
push @$list, shuffle @{ $self->{base} } while @$list < $count;
}
splice( @$list, 0, $count );
}
sub new {
my $class = shift;
no strict 'refs';
my $self = bless { @_, cache => [] }, $class;
# compute some defaults
$self->{category} ||= ${"$class\::Default"};
# fall back to last resort (FIXME should we carp()?)
$self->{category} = ${"$class\::Default"}
if $self->{category} ne ':all'
&& !exists ${"$class\::MultiList"}{ $self->{category} };
$self->_compute_base();
lib/Acme/MetaSyntactic/any.pm view on Meta::CPAN
my $self = shift;
my $theme =
( shuffle( grep { !/^(?:any|random)$/ } Acme::MetaSyntactic->themes() ) )[0];
$self->{meta}->name( $theme, @_ );
}
sub new {
my $class = shift;
# we need a full Acme::MetaSyntactic object, to support AMS::Locale
return bless { meta => Acme::MetaSyntactic->new( @_ ) }, $class;
}
sub theme { $Theme };
sub has_remotelist { };
1;
=encoding iso-8859-1
( run in 0.374 second using v1.01-cache-2.11-cpan-de7293f3b23 )