Acme-MetaSyntactic

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    [DOCUMENTATION]
    - add quotes and links for two blogs posts about Acme::MetaSyntactic
    - update a link to the Perl source history (from Perforce to Git)
    [THEME UPDATE]
    - contributors

1.012 2013-10-14 BOOK
    [ENHANCEMENTS]
    - Test::MetaSyntactic now tries to load each theme in isolation
    [TESTS]
    - do not use blib in t/50usecase.t
    - fix the t/usecase_list8 script to not trigger CPAN.pm
      recursion detection (when loading pause_id)
      (this should fix a long standing installation bug)

1.011 2013-09-16 BOOK
    [ENHANCEMENTS]
    - the name() method now accepts a "$theme/$category" parameter,
      instead of just "$theme"

1.010 2013-08-12 BOOK
    [ENHANCEMENTS]

Changes  view on Meta::CPAN

      problems ("Too many open files"), when loading a lot of themes.
      (see http://www.cpantesters.org/cpan/report/25449004)

1.007 2012-10-08 BOOK
    [ENHANCEMENTS]
    - Test::MetaSyntactic now supports RELEASE_TESTING
      (and keeps supporting AUTHOR_TESTING for backwards compatibility)

1.006 2012-08-26 BOOK
    [ENHANCEMENTS]
    - add support for end-of-line comments in the __DATA__ section
      (in the load_data() method)

1.005 2012-07-24 BOOK
    [TESTS]
    - fix t/31any.t to work with themes having very few items

1.004 2012-06-28 BOOK
    [ENHANCEMENTS]
    - add support for POST request in Acme::MetaSyntactic::RemoteList

MANIFEST  view on Meta::CPAN

t/30list.t
t/31any.t
t/32multi.t
t/33locale.t
t/33locale_territory.t
t/33locale_win32.t
t/34data.t
t/35remote.t
t/35remote2.t
t/40inc.t
t/50usecase.t
t/author-pod-syntax.t
t/lib/Acme/MetaSyntactic/test_ams_alias.pm
t/lib/Acme/MetaSyntactic/test_ams_list.pm
t/lib/Acme/MetaSyntactic/test_ams_locale.pm
t/lib/Acme/MetaSyntactic/test_ams_remote.pm
t/lib/NoLang.pm
t/release-distmeta.t
t/remote
t/remote1
t/remote2
t/usecase_alias1
t/usecase_alias2
t/usecase_alias3
t/usecase_list1
t/usecase_list2
t/usecase_list3
t/usecase_list4
t/usecase_list5
t/usecase_list6
t/usecase_list7
t/usecase_list8
t/usecase_locale_en3
t/usecase_locale_en4
t/usecase_locale_en5
t/usecase_locale_fr1
t/usecase_locale_fr2
t/usecase_locale_fr3
t/usecase_locale_fr4
t/usecase_locale_fr5
t/usecase_locale_fr6

lib/Acme/MetaSyntactic.pm  view on Meta::CPAN

            lingual => "fr de",
        },
        empty => ""
    }

For example, C<Acme::MetaSyntactic::List> uses the single parameter C<names>
to fetch the lists of names for creating its subclasses.

The C<init()> method in all "behaviour" classes will also accept an optional
C<$data> hashref and if it provided, will use it instead of reading the
C<__DATA__> section of the module. The actual structure of the hashref
depends on the C<Acme::MetaSyntactic::> class.

=back

Convenience methods also exists for all the themes. The methods are named
after the theme. They are exported only when the theme is actually used
or when it appear in the C<Acme::MetaSyntactic> import list. The first
imported theme is the default, used by the C<metaname()> function.

=head1 EXPORTS

lib/Acme/MetaSyntactic/Alias.pm  view on Meta::CPAN

    =head1 NAME
    
    Acme::MetaSyntactic::bonk - The bonk theme
    
    =head1 DESCRIPTION
    
    This theme is just an alias of the C<batman> theme.

    =cut
    
    # no __DATA__ section required!

=head1 DESCRIPTION

C<Acme::MetaSyntactic::Alias> is the base class for any themes that is
simply an alias of another theme.

=head1 METHOD

Acme::MetaSyntactic::Alias defines a single method, C<init()> that
make aliases very easy to write (see the full example in L<SYNOPSIS>):

lib/Acme/MetaSyntactic/List.pm  view on Meta::CPAN

=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()

lib/Acme/MetaSyntactic/Locale.pm  view on Meta::CPAN

C<Win32::Locale>).

POSIX locales are defined as C<language[_territory][.codeset][@modifier]>.
If the specific territory is not supported, C<Acme::MetaSyntactic::Locale>
will use the language, and if the language isn't supported either,
the default is used.

=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 (according to the C<lang> parameter passed to the
constructor).

=item lang()

lib/Acme/MetaSyntactic/MultiList.pm  view on Meta::CPAN


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

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

=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 (according to the C<category> parameter passed to the
constructor).

=item category()

lib/Test/MetaSyntactic.pm  view on Meta::CPAN

        $tb->diag("Names too long: @failed") if @failed;
    }
}

# t/24data.t
sub subtest_data {
    my ( $theme, $file ) = @_;
    $file = '' if !defined $file;
    _check_file_lines(
        $theme, $file,
        "__DATA__ section for %s",
        sub {
            my @lines;
            my $in_data;
            for my $line (@_) {
                $in_data++ if $line =~ /^__DATA__$/;
                next if !$in_data;
                push @lines, $line
                    if /^#/ && !/^# ?(?:names(?: +[-\w]+)*|default)\s*$/;
            }
            return @lines;

lib/Test/MetaSyntactic.pm  view on Meta::CPAN


Checks that each metasyntactic name in the theme is a valid Perl
variable name.

=head2 subtest_length( $theme )

Checks that each name in the theme has valid length.

=head2 subtest_data( $theme, $source )

Checks that the C<__DATA__> section (if any) of the theme source is
properly formatted.

=head2 subtest_import( $theme )

Checks that the exported C<meta$theme> function returns an item from
C<$theme>.

=head2 subtest_noimport( $theme )

Checks that C<use Acme::MetaSyntactic::I<$theme> ()> does not export

t/00-report-prereqs.t  view on Meta::CPAN

}
else {
    $cpan_meta_error = $@;    # capture error from CPAN::Meta->load_file($source)
    $source = 'static metadata';
}

my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;

# Add static includes into a fake section
for my $mod (@include) {
    $req_hash->{other}{modules}{$mod} = 0;
}

for my $phase ( qw(configure build test runtime develop other) ) {
    next unless $req_hash->{$phase};
    next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});

    for my $type ( qw(requires recommends suggests conflicts modules) ) {
        next unless $req_hash->{$phase}{$type};

t/50usecase.t  view on Meta::CPAN

use strict;
use Test::More;
use File::Spec::Functions;
use File::Glob;

my $dir;
BEGIN { $dir = catdir qw( t lib ); }
use lib $dir;

my @list_cases      = File::Glob::bsd_glob catfile(qw(t usecase_list*));
my @locale_fr_cases = File::Glob::bsd_glob catfile(qw(t usecase_locale_fr*));
my @locale_en_cases = File::Glob::bsd_glob catfile(qw(t usecase_locale_en*));
my @alias_cases     = File::Glob::bsd_glob catfile(qw(t usecase_alias*));

plan tests => 2
    * ( @list_cases + @locale_fr_cases + @locale_en_cases + @alias_cases );

LIST: {
    use Acme::MetaSyntactic::test_ams_list;
    my %items = map { $_ => 1 } @Acme::MetaSyntactic::test_ams_list::List;

    for (@list_cases) {
        my $result = `$^X "-I$dir" -Mstrict -w $_`;



( run in 0.790 second using v1.01-cache-2.11-cpan-39bf76dae61 )