| 1 | package Acme::MetaSyntactic::any; | ||
| 2 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 4 | ▶ | use List::Util 'shuffle'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use Acme::MetaSyntactic (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | our $VERSION = '1.000'; | |
| 6 | |||
| 7 | 4 | our $Theme = 'any'; | |
| 8 | |||
| 9 | sub import { | ||
| 10 | # export the metaany function | ||
| 11 | 3 | ▶ | my $callpkg = caller; |
|
Subroutine
import: called CC=1 SCAR=0.0
| |||
| 12 | 3 | my $meta = Acme::MetaSyntactic::any->new(); | |
| 13 | 4 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 3 | ▶ | *{"$callpkg\::metaany"} = sub { $meta->name( @_ ) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 15 | } | ||
| 16 | |||
| 17 | sub name { | ||
| 18 | 4 | ▶ | my $self = shift; |
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | my $theme = | ||
| 20 | 4 | ( shuffle( grep { !/^(?:any|random)$/ } Acme::MetaSyntactic->themes() ) )[0]; | |
| 21 | 4 | $self->{meta}->name( $theme, @_ ); | |
| 22 | } | ||
| 23 | |||
| 24 | sub new { | ||
| 25 | 7 | ▶ | my $class = shift; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 26 | |||
| 27 | # we need a full Acme::MetaSyntactic object, to support AMS::Locale | ||
| 28 | 7 | return bless { meta => Acme::MetaSyntactic->new( @_ ) }, $class; | |
| 29 | } | ||
| 30 | |||
| 31 | 2 | ▶ | sub theme { $Theme }; |
|
Subroutine
theme: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | |||
| 33 | ▶ | sub has_remotelist { }; | |
|
Subroutine
has_remotelist: not called CC=1 SCAR=0.0
Pod
documented
| |||
| 34 | |||
| 35 | 4 | 1; | |
| 36 | |||
| 37 | =encoding iso-8859-1 | ||
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Acme::MetaSyntactic::any - Items from any theme | ||
| 42 | |||
| 43 | =head1 DESCRIPTION | ||
| 44 | |||
| 45 | This theme simply selects a theme at random from all available | ||
| 46 | themes, and returns names from it. | ||
| 47 | |||
| 48 | The selection is done in such a manner that you'll see no repetition | ||
| 49 | in the items returned from a given theme, until all items from the | ||
| 50 | theme have been seen. | ||
| 51 | |||
| 52 | =head1 METHODS | ||
| 53 | |||
| 54 | =over 4 | ||
| 55 | |||
| 56 | =item new( @args ) | ||
| 57 | |||
| 58 | Create a new instance. | ||
| 59 | |||
| 60 | The parameters will be used to create the underlying Acme::MetaSyntactic | ||
| 61 | object, and will be passed to the randomly chosen theme. This can be | ||
| 62 | useful for themes deriving from Acme::MetaSyntactic::Locale. | ||
| 63 | |||
| 64 | =item name( $count ) | ||
| 65 | |||
| 66 | Implement the name() method for this class. | ||
| 67 | |||
| 68 | =item theme() | ||
| 69 | |||
| 70 | Return the theme name (C<any>). | ||
| 71 | |||
| 72 | =item has_remotelist() | ||
| 73 | |||
| 74 | Always return false. | ||
| 75 | |||
| 76 | =back | ||
| 77 | |||
| 78 | =head1 CONTRIBUTOR | ||
| 79 | |||
| 80 | Philippe Bruhat, upon request of Sébastien Aperghis-Tramoni. | ||
| 81 | |||
| 82 | Introduced in Acme-MetaSyntactic version 0.12, published on March 7, 2005. | ||
| 83 | |||
| 84 | Updated to conform with interface changes required by | ||
| 85 | C<Acme::MetaSyntactic::Updatable> in version 0.49, published | ||
| 86 | on November 21, 2005. | ||
| 87 | |||
| 88 | Received its own version number for Acme-MetaSyntactic version 1.000, | ||
| 89 | published on May 7, 2012. | ||
| 90 | |||
| 91 | =head1 SEE ALSO | ||
| 92 | |||
| 93 | L<Acme::MetaSyntactic>. | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||