Acme-MetaSyntactic
view release on metacpan or search on metacpan
0.54 2005-12-22 BOOK
[NEW WEEKLY THEME 2005/12/26]
- barbapapa (Abigail)
0.53 2005-12-19 BOOK
[NEW WEEKLY THEME 2005/12/19]
- opcodes (Abigail)
[ENHANCEMENTS]
- the list of themes (as returned by themes() is still computed
at startup, but if new themes appear while the current script
is running, they can be "required" without a restart
[THEME UPDATE]
- dilbert
0.52 2005-12-11 BOOK
[NEW WEEKLY THEME 2005/12/12]
- us_presidents (Abigail)
[THEME UPDATE]
- dilbert
0.51 2005-12-04 BOOK
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
lib/Acme/MetaSyntactic.pm view on Meta::CPAN
=back
=head1 THEMES
The list of available themes can be obtained with the following one-liner:
$ perl -MAcme::MetaSyntactic -le 'print for Acme::MetaSyntactic->themes'
The themes are all the C<Acme::MetaSyntactic::I<theme>> classes, with
I<theme> starting with a lowercase letter.
The items that make up Acme::MetaSyntactic themes are finite lists of
valid Perl identifiers (not the UTF-8 kind).
=head2 Theme behaviours
C<Acme::MetaSyntactic> provides theme authors with the capability of creating
theme "behaviours". Behaviours are implemented as classes from which the
individual themes inherit.
The behaviours are all the C<Acme::MetaSyntactic::I<type>> classes, with
I<type> starting with an uppercase letter.
Here are the available behaviours:
=over 4
=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.
lib/Test/MetaSyntactic.pm view on Meta::CPAN
our @EXPORT = qw( all_themes_ok theme_ok );
our $VERSION = '1.005';
#
# exported functions
#
sub all_themes_ok {
my (@lib) = @_;
@lib = _starting_points() if !@lib;
my %source = Acme::MetaSyntactic->_find_themes(@lib);
my $tb = __PACKAGE__->builder;
local $Test::Builder::Level = $Test::Builder::Level + 1;
$tb->plan( tests => scalar keys %source );
my @fail;
theme_ok( $_, $source{$_} ) or push @fail, $_ for sort keys %source;
$tb->diag("Test suite failed for the following:") if @fail;
$tb->diag("- $_") for @fail;
}
lib/Test/MetaSyntactic.pm view on Meta::CPAN
$tb->subtest( "$theme remote", sub { subtest_remote(@args); } );
$tb->done_testing;
}
);
}
#
# useful internal functions
#
# some starting points to look for theme modules
sub _starting_points {
return 'blib/lib' if -e 'blib/lib';
return 'lib';
}
# load the theme in a random namespace
{
my $num = 0;
sub _load {
my ( $theme, $do_import ) = @_;
lib/Test/MetaSyntactic.pm view on Meta::CPAN
return @items;
}
sub _check_file_lines {
my ($theme, $file, $mesg, $cb ) = @_;
my $tb = __PACKAGE__->builder;
$tb->plan( tests => 1 );
local $Test::Builder::Level = $Test::Builder::Level + 1;
# try to find a source file if none given
$file ||= { Acme::MetaSyntactic->_find_themes(_starting_points) }->{$theme};
SKIP: {
my ($fh, $skip);
if ( $file ) {
open $fh, $file or do { $skip = "Can't open $file: $!"; };
}
else {
$skip = "This test needs the source file for $theme";
}
if( $skip ) {
script/meta view on Meta::CPAN
"meta, a simple front-end to Acme::MetaSyntactic version $Acme::MetaSyntactic::VERSION\n"
if $conf{version};
print STDERR $usage if $conf{help};
print map "$_\n", Acme::MetaSyntactic->themes if $conf{themes};
if ( $conf{sources} ) {
my @sources = $module->sources( $conf{category} );
print map "$_\n", @sources;
}
exit if $conf{themes} || $conf{version} || $conf{help} || $conf{sources};
# real processing starts here
$\ = $/;
my $sep = $conf{whitespace} ? ' ' : $\;
my $meta = Acme::MetaSyntactic->new( $theme, category => $conf{category} );
my (@remote, @local);
@remote = $module->remote_list( $conf{category} )
if $conf{remote} || $conf{check};
if ( !$conf{remote} ) {
my $count = shift;
script/metafy view on Meta::CPAN
}
# informative options
print STDERR
"metafy your files, using Acme::MetaSyntactic version $Acme::MetaSyntactic::VERSION\n"
if $conf{version};
print STDERR $usage if $conf{help};
print map "$_\n", Acme::MetaSyntactic->themes if $conf{themes};
exit if $conf{themes} || $conf{version} || $conf{help};
# real processing starts here
my $from =
Acme::MetaSyntactic->new( $conf{from}, category => $conf{from_category} );
my $to = Acme::MetaSyntactic->new( $conf{to}, category => $conf{to_category} );
my @to = $to->name(0);
my %to;
# find the origin list
my $re_from = qr/\b(@{[join'|', sort $from->name( 0 ) ]})\b/;
# modify files in place
( run in 0.297 second using v1.01-cache-2.11-cpan-0d8aa00de5b )