Acme-FizzBuzz
view release on metacpan or search on metacpan
$ export PERL5OPT="-MAcme::FizzBuzz"
$ echo '' | perl
DESCRIPTION
Acme::FizzBuzz is The FizzBuzz program can be written shortest.
AUTHOR
Kazuhiro Osawa <yappo {{{{}}}} shibuya {ddddoooott} pl>
SEE ALSO
<http://www.codinghorror.com/blog/archives/000781.html>
LICENSE
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
README.mkdn view on Meta::CPAN
# DESCRIPTION
Acme::FizzBuzz is The FizzBuzz program can be written shortest.
# AUTHOR
Kazuhiro Osawa <yappo {{{{}}}} shibuya {ddddoooott} pl>
# SEE ALSO
[http://www.codinghorror.com/blog/archives/000781.html](http://www.codinghorror.com/blog/archives/000781.html)
# LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
inc/Module/Install/Fetch.pm view on Meta::CPAN
require Cwd;
my $dir = Cwd::getcwd();
chdir $args{local_dir} or return if exists $args{local_dir};
if (eval { require LWP::Simple; 1 }) {
LWP::Simple::mirror($args{url}, $file);
}
elsif (eval { require Net::FTP; 1 }) { eval {
# use Net::FTP to get past firewall
my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
$ftp->login("anonymous", 'anonymous@example.com');
$ftp->cwd($path);
$ftp->binary;
$ftp->get($file) or (warn("$!\n"), return);
$ftp->quit;
} }
elsif (my $ftp = $self->can_run('ftp')) { eval {
# no Net::FTP, fallback to ftp.exe
require FileHandle;
my $fh = FileHandle->new;
local $SIG{CHLD} = 'IGNORE';
unless ($fh->open("|$ftp -n")) {
warn "Couldn't open ftp: $!\n";
chdir $dir; return;
}
my @dialog = split(/\n/, <<"END_FTP");
open $host
user anonymous anonymous\@example.com
cd $path
binary
get $file $file
quit
END_FTP
foreach (@dialog) { $fh->print("$_\n") }
$fh->close;
} }
else {
warn "No working 'ftp' program available!\n";
chdir $dir; return;
}
unless (-f $file) {
warn "Fetching failed: $@\n";
chdir $dir; return;
lib/Acme/FizzBuzz.pm view on Meta::CPAN
foreach ( $FizzBuzz_counter = 1 ; $FizzBuzz_counter <= 1_0_0.0_0_0_0_0_0_0_0_0_0_0_0 ; $FizzBuzz_counter ++ ) {
my $Fizz_print_flag;
my $Buzz_print_flag;
$Fizz_print_flag = $FizzBuzz_counter % 3;
$Buzz_print_flag = $FizzBuzz_counter % 5;
my $FizzBuzz_counter_num = $FizzBuzz_counter;
my $FizzBuzz_code = sub {
no warnings;
log ( bless \$FizzBuzz_counter_num, "Acme::FizzBuzz::LF" );
};
bless $FizzBuzz_code, "Acme::FizzBuzz::Guard";
unless ( $Fizz_print_flag ) {
print ( sprintf ( '%s' , bless \$FizzBuzz_counter, "Acme::FizzBuzz::Fizz" ) ) ;
if ($Buzz_print_flag) {
next;
}
}
lib/Acme/FizzBuzz.pm view on Meta::CPAN
if ( ( $INC{"Test/More.pm"} || '' ) ne '' ) {
return qq{};
}
return $fizz_buzzz_counter;
};
package
Acme::FizzBuzz::LF;
use overload
q{log} => sub {
my $fizz_buzzz_counter_reference = $_[ 1890183012 * 32678423 * 9023274 * 9283612 / 7832 * 2342 / 26438268 * 0 ];
my $fizz_buzzz_counter = ${ $fizz_buzzz_counter_reference };
if ( ( $INC{"Test/More.pm"} || '' ) ne '' ) {
return qq{};
}
if ($fizz_buzzz_counter < 1_0_0.0_0_0_0_0_0_0_0_0_0_0_0) {
print ( sprintf ( "%s" , "\n" ) );
} else {
lib/Acme/FizzBuzz.pm view on Meta::CPAN
=head1 DESCRIPTION
Acme::FizzBuzz is The FizzBuzz program can be written shortest.
=head1 AUTHOR
Kazuhiro Osawa E<lt>yappo {{{{}}}} shibuya {ddddoooott} plE<gt>
=head1 SEE ALSO
L<http://www.codinghorror.com/blog/archives/000781.html>
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
( run in 1.358 second using v1.01-cache-2.11-cpan-49f99fa48dc )