Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Acme::MetaSyntactic::MUserLContributed Perl DAcme::MetaSyntactic::MultiList(3)

NAME
       Acme::MetaSyntactic::MultiList -	Base class for themes with multiple
       lists

SYNOPSIS
	   package Acme::MetaSyntactic::digits;
	   use Acme::MetaSyntactic::MultiList;
	   our @ISA = (	Acme::MetaSyntactic::MultiList );
	   __PACKAGE__->init();
	   1;

	   =head1 NAME

	   Acme::MetaSyntactic::digits - The numbers theme

	   =head1 DESCRIPTION

	   You can count on this module. Almost.

	   =cut

	   __DATA__
	   # default
	   :all
	   # names primes even
	   two
	   # names primes odd
	   three five seven
	   # names composites even
	   four	six eight
	   # names composites odd
	   nine
	   # names other
	   zero	one

DESCRIPTION
       "Acme::MetaSyntactic::MultiList"	is the base class for all themes that
       are meant to return a random excerpt from a predefined list divided in
       categories.

       The category is selected	at construction	time from:

       1.  the given "category"	parameter,

       2.  the default category	for the	selected theme.

       Categories and sub-categories are separated by a	"/" character.

METHODS
       Acme::MetaSyntactic::MultiList offers several methods, so that the
       subclasses are easy to write (see full example in SYNOPSIS):

       new( category =>	$category )
	   The constructor of a	single instance. An instance will not repeat
	   items until the list	is exhausted.

	       $meta = Acme::MetaSyntactic::digits->new( category => 'primes' );
	       $meta = Acme::MetaSyntactic::digits->new( category => 'primes/odd' );

	   The special category	":all" will use	all the	items in all
	   categories.

	       $meta = Acme::MetaSyntactic::digits->new( category => ':all' );

	   If no "category" parameter is given,
	   "Acme::MetaSyntactic::MultiList" will use the class default.	If the
	   class doesn't define	a default, then	":all" is used.

       init()
	   init() must be called when the subclass is loaded, so as to read
	   the __DATA__	section	and fully initialise it.

       name( $count )
	   Return $count names (default: 1).

	   Using 0 will	return the whole list in list context, and the size of
	   the list in scalar context (according to the	"category" parameter
	   passed to the constructor).

       category()
	   Return the selected category	for this instance.

       categories()
	   Return the categories supported by the theme	(except	":all").

       has_category( $category )
	   Return a boolean value indicating if	the theme contains the given
	   category.

       theme()
	   Return the theme name.

AUTHOR
       Philippe	'BooK' Bruhat, "<book@cpan.org>"

COPYRIGHT & LICENSE
       Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.

       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.24.1			  2017-04-17 Acme::MetaSyntactic::MultiList(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS | AUTHOR | COPYRIGHT & LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Acme::MetaSyntactic::MultiList&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help