Acme-EyeDrops

 view release on metacpan or  search on metacpan

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

Instead of using the API, as shown above, you may find it more
convenient to use the F<sightly.pl> command in the F<demo> directory:

    sightly.pl -h           (for help)
    sightly.pl -s camel -f helloworld.pl -r 1 >new.pl
    cat new.pl              (should look like a camel)
    perl new.pl             (should print "hello world" as before)

Notice that the shape C<'camel'> is just the file F<camel.eye> in
the F<EyeDrops> sub-directory underneath where F<EyeDrops.pm> is located,
so you are free to add your own new shapes as required.

For the meaning of Regex => 1 above, see the I<Just another Perl hacker>
section below.

=head2 Making Your Programs Easier to Understand

If your boss demands a UML diagram describing your program, you
can give him this:

    print sightly( { Shape       => 'uml',

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

trailing spaces, which complicates the above program.

Buffy looking in the mirror can now be created with:

    sightly.pl -r 1 -f k.pl -s buffy2 >b.pl
    cat b.pl        (should show Buffy's face)
    perl b.pl       (should show Buffy looking in the mirror)

Drat. This requires two I<buffy2> shapes. What to do?
Well, you could use the C<TrailingSpaces> attribute
(C<-T> switch to F<sightly.pl>) to append the required
number of trailing spaces to each line, allowing you to
write a briefer F<kk.pl>:

    open$%;chop,print+reverse.$/for<0>

and finally produce I<Buffy looking in the mirror> with:

    sightly.pl -T -r 1 -f kk.pl -s buffy2 >bb.pl

Alternatively, the C<Compact> attribute (C<-m> switch to

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

    %"'"'"'###%*'"'"'"ZT%?ZT%?ZS'>Zv~;
    s;\s;;g;
    $;='@,=map{$.=$";join"",map((($.^=O)x(-33+ord)),/./g),$/}split+Z;
    s/./(rand)<.2?"o":$"/egfor@;=((5x84).$/)x30;map{
    system$^O=~W?CLS:"clear";print@;;splice@;,-$_,2,pop@,;
    @;=($/,@;);sleep!$%}2..17';
    $;=~s;\s;;g;eval$;

The rules of this contest state that the program source code must fit
precisely into the provided snowflake shape. To comply, you can pour
the above program into the required shape with:

    sightly.pl -s snow -f snowing.pl -t -u# -n1 >snowflake.pl

or equivalently (using the API instead of F<sightly.pl>):

    print sightly( { Shape       => 'snow',
                     SourceFile  => 'snowing.pl',
                     Text        => 1,
                     TextFiller  => '#',
                     Indent      => 1 } );

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


    Reduce         Reduce the size of the shape.

    Expand         Expand the size of the shape.

    Invert         Boolean. Invert the shape.

    Indent         Indent the shape. The number of spaces to indent.

    TrailingSpaces Boolean. Ensure all lines of the shape are of equal
                   length, adding trailing spaces if required.

    RemoveNewlines Boolean. Remove all newlines from the source before
                   conversion.

    BorderGap      Put a border around the shape. Gap between border
                   and the shape.

    BorderGapLeft,BorderGapRight,BorderGapTop,BorderGapBottom
                   You can override BorderGap with one or more from
                   the above.

t/16_astride.t  view on Meta::CPAN

use strict;
use warnings;
use Config;
use Acme::EyeDrops qw(ascii_to_sightly sightly_to_ascii);

sub skip_test { print "1..0 # Skipped: $_[0]\n"; exit }

BEGIN {
   $] >= 5.008 && $Config{'useithreads'} or skip_test('no threads');
   eval { require threads };
   skip_test('threads module required for testing threads') if $@;
   'threads'->import();

   eval { require Test::More };
   skip_test('Test::More required for testing threads') if $@;
   Test::More->import();
}

# --------------------------------------------------

$|=1;

my $Num_Threads =  3;
my $N_Iter      = 10;

t/17_Orange.t  view on Meta::CPAN

#!/usr/bin/perl

use strict;

sub skip_test { print "1..0 # Skipped: $_[0]\n"; exit }

BEGIN {
   eval { require Test::More };
   skip_test('Test::More required for testing Test::Pod::Coverage') if $@;
   Test::More->import();
}

# --------------------------------------------------

eval "use Test::Pod::Coverage 0.08";
plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@;
all_pod_coverage_ok();

t/18_sky.t  view on Meta::CPAN

#!/usr/bin/perl

use strict;

sub skip_test { print "1..0 # Skipped: $_[0]\n"; exit }

BEGIN {
   eval { require Test::More };
   skip_test('Test::More required for Test::Pod') if $@;
   Test::More->import();
}

# --------------------------------------------------

eval "use Test::Pod 1.12";
plan skip_all => "Test::Pod 1.12 required for testing POD" if $@;
all_pod_files_ok();



( run in 0.568 second using v1.01-cache-2.11-cpan-0a6323c29d9 )