Acme-MetaSyntactic
view release on metacpan or search on metacpan
- phonetic (Dutch list by Abigail)
- pm_groups
- punctuation (update from wikipedia by Abigail)
- yapc (new YAPC by Abigail)
0.90 2006-09-03 BOOK
[NEW WEEKLY THEME 2006/09/04]
- state_flowers (Abigail)
[THEME UPDATES]
- pause_id
- yapc (Vienna and Houston were selected for 2007)
0.89 2006-08-28 BOOK
[NEW WEEKLY THEME 2006/08/28]
- pause_id
[THEME UPDATES]
- dilbert
- planets (Pluto is not a planet anymore)
- pornstars
0.88 2006-08-22 BOOK
- pornstars (Sébastien Aperghis-Tramoni)
[ENHANCEMENTS]
- New behaviour Acme::MetaSyntactic::MultiList allows themes
to be organised in categories and sub-categories. Usage is
similar to Acme::MetaSyntactic::Locale (except that the
constructor parameter is named 'category')
- the first theme to use this feature is... pornstars
- Acme::MetaSyntactic::RemoteList has a new method sources()
that can report the source URLs for subcategories (for
Acme::MetaSyntactic::RemoteList)
- the meta script accepts a new --category option, to select
a category within an Acme::MetaSyntactic::MultiList theme
[TESTS]
- Since 0.59, Acme::MetaSyntactic::RemoteList could accept
serveral sources. This functionality is now fully tested.
- tests for Acme::MetaSyntactic::MultiList
- skip a few more tests if LWP::UserAgent is not installed
[THEME UPDATE]
- hhgg (updated a reference link)
0.68 2006-03-24 BOOK
0.13 2005-03-06 BOOK
[NEW WEEKLY THEME 2005/03/14]
- loremipsum (Jérôme Fenal)
0.12 2005-03-06 BOOK
[ENHANCEMENTS]
- To prevent endless growth of the Acme::MetaSyntactic module,
and support various theme behaviours, support for behaviour
classes has been added.
- The first behaviour class is Acme::MetaSyntactic::List, which
reproduces the previous behaviour of selecting a number
of random items from a list, with no repetition until
the list is exhausted.
- The 17 existing themes have been converted to the new scheme.
[USAGE]
- Acme::MetaSyntactic is a dependency for a least one module!
Praise Bot::MetaSyntactic, which is the core of the meta bot
running on irc://irc.perl.org/perlfr
[INCOMPATIBILITIES]
- the API has changed a little:
+ Acme::MetaSyntactic does not has methods named after the
lib/Acme/MetaSyntactic.pm view on Meta::CPAN
=item C<Acme::MetaSyntactic::List>
The theme is a simple collection of names. An object instance will
return names at random from the list, and not repeat any until the list
is exhausted.
=item C<Acme::MetaSyntactic::Locale>
The theme is made of several collections of names, each associated with
a "language". The language is either passed as a constructor parameter,
extracted from the environment or a default is selected.
=item C<Acme::MetaSyntactic::MultiList>
The theme is made of several collections of names, each associated with
a "category". Categories can include sub-categories, etc, I<ad infinitum>
(or when disk space or memory is exhausted, whichever happens first).
The category is either passed as a constructor parameter or the default
value is selected.
=item C<Acme::MetaSyntactic::Alias>
The theme is simply an alias of another theme. All items are identical,
as the original behaviour. The only difference is the theme name.
=back
Over time, new theme "behaviours" will be added.
lib/Acme/MetaSyntactic/Locale.pm view on Meta::CPAN
zero uno due tre quattro cinque sei sette otto nove
# names yi
nul eyn tsvey dray fir finf zeks zibn akht nayn
=head1 DESCRIPTION
C<Acme::MetaSyntactic::Locale> is the base class for all themes that are
meant to return a random excerpt from a predefined list I<that depends
on the language>.
The language is selected at construction time from:
=over 4
=item 1.
the given C<lang> or C<category> parameter,
=item 2.
the current locale, as given by the environment variables C<LANGUAGE>,
C<LANG> or (under Win32) Win32::Locale.
=item 3.
the default language for the selected theme.
=back
The language codes should conform to the RFC 3066 and ISO 639 standard.
=head1 METHODS
Acme::MetaSyntactic::Locale offers several methods, so that the subclasses
are easy to write (see full example in L<SYNOPSIS>):
lib/Acme/MetaSyntactic/Locale.pm view on Meta::CPAN
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 (according to the C<lang> parameter passed to the
constructor).
=item lang()
=item category()
Return the selected language for this instance.
=item languages()
=item categories()
Return the languages supported by the theme.
=item theme()
Return the theme name.
lib/Acme/MetaSyntactic/MultiList.pm view on Meta::CPAN
nine
# names other
zero one
=head1 DESCRIPTION
C<Acme::MetaSyntactic::MultiList> is the base class for all themes
that are meant to return a random excerpt from a predefined list
I<divided in categories>.
The category is selected at construction time from:
=over 4
=item 1.
the given C<category> parameter,
=item 2.
the default category for the selected theme.
=back
Categories and sub-categories are separated by a C</> character.
=head1 METHODS
Acme::MetaSyntactic::MultiList offers several methods, so that the subclasses
are easy to write (see full example in L<SYNOPSIS>):
lib/Acme/MetaSyntactic/MultiList.pm view on Meta::CPAN
=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 (according to the C<category> parameter passed to the
constructor).
=item category()
Return the selected category for this instance.
=item categories()
Return the categories supported by the theme (except C<:all>).
=item has_category( $category )
Return a boolean value indicating if the theme contains the given category.
=item theme()
lib/Acme/MetaSyntactic/RemoteList.pm view on Meta::CPAN
Return the data structure containing the source URLs. This can be quite
different depending on the class: a single scalar (URL), an array
reference (list of URLs) or a hash reference (each value being either
a scalar or an array reference) for themes that are subclasses of
C<Acme::MetaSyntactic::MultiList>.
=item sources( [ $category ] )
Return the list of source URL. The C<$category> parameter can be used
to select the sources for a sub-category of the theme (in the case of
C<Acme::MetaSyntactic::MultiList>).
C<$category> can be an array reference containing a list of categories.
=item extract( $content )
Return a list of items from the C<$content> string. C<$content> is
expected to be the content available at the URL given by C<source()>.
=back
lib/Acme/MetaSyntactic/any.pm view on Meta::CPAN
1;
=encoding iso-8859-1
=head1 NAME
Acme::MetaSyntactic::any - Items from any theme
=head1 DESCRIPTION
This theme simply selects a theme at random from all available
themes, and returns names from it.
The selection is done in such a manner that you'll see no repetition
in the items returned from a given theme, until all items from the
theme have been seen.
=head1 METHODS
=over 4
=item new( @args )
Create a new instance.
script/meta view on Meta::CPAN
Fetch the remote list (if available) and print only the differences betwen
the current list and the remote list (items are prefixed by C<+> and C<->).
Option added by Abigail.
The output of this option is affected by the I<--whitespace> option.
=item I<--category> category
Only select items in the given category (for C<Acme::MetaSyntactic::MultiList>
subclasses). If not given, use the default category.
Silently fallbacks to the default if the category doesn't exist.
Another way to ask for a specific category is to skip the I<--category>
option and directly ask for C<theme/category>. Note that you cannot use
both calling conventions simultaneously.
=back
=head2 Informative options
The program will exit if any of these options is selected.
However, these options can be combined.
=over 4
=item I<--themes>
Print the list of available themes.
=item I<--sources>
script/metafy view on Meta::CPAN
B<This will definitely break any program!>
=item I<--in-place>
Force in-place edition
=back
=head2 Informative options
The program will exit if any of these options is selected.
However, these options can be combined.
=over 4
=item I<--themes>
Print the list of available themes.
=item I<--version>
use Test::More;
use Acme::MetaSyntactic::any;
use lib 't/lib';
use NoLang;
# "alter" the shuffle method
{
no warnings;
my ( $i, $j ) = ( 0, 0 );
*List::Util::shuffle = sub { sort @_ }; # item selection
*Acme::MetaSyntactic::any::shuffle = # theme selection
sub (@) { my @t = sort @_; push @t, shift @t for 1 .. $j; $j++; @t };
}
# compute the first 6 installed themes
my $meta = Acme::MetaSyntactic->new();
my $count = my @themes = grep { ! /^any$/ } sort $meta->themes();
my $max = $count >= 6 ? 5 : $count - 1;
@themes = @themes[ 0 .. $max ];
# the test list is computed now because of cache issues
( run in 0.592 second using v1.01-cache-2.11-cpan-49f99fa48dc )