Acme-Bleach-Numerically

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


      # Or do your own bleaching
      use Acme::Bleach::Numerically qw/num2str str2num/;
      my $world = str2num(qq{print "hello, world!\n";})

DESCRIPTION
    Georg Cantor has found that you can squeeze the whole world between zero
    and one. Many say he went insane because of that but the reality is, he
    just bleached himself with continuum hypothesis :)

    This module does just that -- map your whole world onto a single point
    between 0 and 1. Welcome to the Programming Continuum of Perl!

  EXPORT
    This module autobleaches when no argument is passed via "use". When you
    pass arguments, you can import "str2num" and "num2str" functions on
    demand.

BUGS
    This module is pretty slow when trying to bleach very large scripts.

lib/Acme/Bleach/Numerically.pm  view on Meta::CPAN

  # Or do your own bleaching
  use Acme::Bleach::Numerically qw/num2str str2num/;
  my $world = str2num(qq{print "hello, world!\n";})

=head1 DESCRIPTION

Georg Cantor has found that you can squeeze the whole world between
zero and one.  Many say he went insane because of that but the reality
is, he just bleached himself with continuum hypothesis :)

This module does just that -- map your whole world onto a single point
between 0 and 1.  Welcome to the Programming Continuum of Perl!

=head2 EXPORT

This module autobleaches when no argument is passed via C<use>.  When
you pass arguments, you can import C<str2num> and C<num2str> functions
on demand.

=head1 BUGS

t/01-RoundTrip.t  view on Meta::CPAN

# $Id: 01-RoundTrip.t,v 0.1 2005/08/30 01:32:11 dankogai Exp $
#
use strict;
use Test::More tests => 27;
require Acme::Bleach::Numerically;
Acme::Bleach::Numerically->import(qw/num2str str2num/);

is(str2num(''),  0, qq(str2num('') is 0));
is(num2str(0),  '', qq(num2str(0) is ''));

my $ascii = join '', map {chr} (0..255);
is(num2str(str2num($ascii)), $ascii, "ascii table");

open my $fh, "<:raw", $0 or die "$0 : $!";
my @lines = <$fh>;
my $file = join '', @lines;
close $fh; chomp @lines;
for my $line (@lines){
    is(num2str(str2num($line)), $line, $line);
}
is(num2str(str2num($file)), $file, "Whole File");



( run in 0.377 second using v1.01-cache-2.11-cpan-49f99fa48dc )