Acme-MetaSyntactic
view release on metacpan or search on metacpan
lib/Acme/MetaSyntactic/List.pm view on Meta::CPAN
bless { cache => [] }, $class;
}
sub theme {
my $class = ref $_[0] || $_[0];
no strict 'refs';
return ${"$class\::Theme"};
}
1;
__END__
=head1 NAME
Acme::MetaSyntactic::List - Base class for simple lists of names
=head1 SYNOPSIS
package Acme::MetaSyntactic::beatles;
use Acme::MetaSyntactic::List;
our @ISA = ( Acme::MetaSyntactic::List );
__PACKAGE__->init();
1;
=head1 NAME
Acme::MetaSyntactic::beatles - The fab four theme
=head1 DESCRIPTION
Ladies and gentlemen, I<The Beatles>. I<(hysteric cries)>
=cut
__DATA__
# names
john paul
george ringo
=head1 DESCRIPTION
C<Acme::MetaSyntactic::List> is the base class for all themes that are
meant to return a random excerpt from a predefined list.
=head1 METHOD
Acme::MetaSyntactic::List offers several methods, so that the subclasses
are easy to write (see full example in L<SYNOPSIS>):
=over 4
=item new()
The constructor of a single instance. An instance will not repeat items
until the list is exhausted.
=item init()
init() must be called when the subclass is loaded, so as to read the
__DATA__ section and fully initialise it.
=item name( $count )
Return $count names (default: C<1>).
Using C<0> will return the whole list in list context, and the size of the
list in scalar context.
=item theme()
Return the theme name.
=back
=head1 AUTHOR
Philippe 'BooK' Bruhat, C<< <book@cpan.org> >>
=head1 COPYRIGHT
Copyright 2005-2012 Philippe 'BooK' Bruhat, All Rights Reserved.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
( run in 1.003 second using v1.01-cache-2.11-cpan-39bf76dae61 )