Acme-Zalgo

 view release on metacpan or  search on metacpan

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

	if (not defined $max) {
		$max = $min;
		$min = 0;
	}
	return int(rand($max - $min)) + $min; 
}

sub rand_char {
	my ($s) = @_;
	return substr($s, randint(length $s), 1);
}

sub zalgo_char {
	my ($c, $upmin, $upmax, $midmin, $midmax, $downmin, $downmax) = @_;
	for my $i (1..randint($upmin, $upmax)) {
		$c .= rand_char($ZALGO[0]);
	}
	for my $i (1..randint($midmin, $midmax)) {
		$c .= rand_char($ZALGO[1]);
	}
	for my $i (1..randint($downmin, $downmax)) {
		$c .= rand_char($ZALGO[2]);
	}
	return $c;
}

sub zalgo {
	if (not @_) {
		@_ = ("HE COMES");
	}
	if (@_ == 1) {
		push @_, (0,5, 0,5, 0,5);
	} elsif (@_ == 2) {
		my ($s, $max) = @_;
		@_ = ($s, 0, $max, 0, $max, 0, $max);
	}
	my ($str, $minup, $maxup, $minmid, $maxmid, $mindown, $maxdown) = @_;
	$str =~ s/$ZALGO_REGEX/zalgo_char($1,$minup,$maxup+1,$minmid,$maxmid+1,$mindown,$maxdown+1)/ge;
	return $str;
}	

package 
	COMES;  # hide from cpan

sub HE {
	my $pkg = shift;
	Acme::Zalgo::zalgo(@_);
}

1;	
__END__

=head1 NAME

Acme::Zalgo - The Nezperdian hive-mind of chaos. 

=head1 SYNOPSIS

    use Acme::Zalgo;

    binmode STDOUT, ':utf8';

    print zalgo("Hello world\n");

    # alternate syntax.  NO COMMAS, THEY ARE FORBIDDEN
    print HE COMES "Tony The Pony\n";

=head1 DESCRIPTION

T͇̟̺o̩̭̖͡ ͚̯̕i̤̜͜n̮̹͕͕v̛̬̬̭̙͖̲̺o̳̪̘̻͔̺ͅk͕̪̟̙͓͘e҉̜̹̟̞ͅ ̪̜̥̯͍th̗̩̠̜̱e̝̰͖̤͓͜ͅ ͈̩̰͎̙̙̮h̴̥i҉͇͙͉̮v̜̣̗̖̭ẹ͞-̱͔͙m͔i̲̪̙͜n̩̲̳̝̮̯͈d̟̫̟̦̖̯̗́ ҉̹͓̰͓͕̲̻...
̜͓͍͖́Iń̰̯̬̤̹v̼̬̠ͅo̠̜k̦̠͚̞i͚͉͜ṇ̯͎g̛̥ ̣̹̜̟͇̬t̲̞̫̪he̜͕̮̲ ͖̞͍̱̖ͅf҉͙͙͓̱̦̰e̺̞̯̩̩e̸l̸͙͔i̼̠̲͍͎͓͜ń̻̻̘͔̳̝͍g̝̼̹͕͖ ̨̩o̰̤̻f̻̝̯͉̪͇͟ ̦̱̱͜c҉̝̜͓̮̰̞̦h̸̬͍̖...
̫̖̝̬̪̣ͅW̭̮͇̼̼i͍̙̘͎̩̤t̘̩̝̥̭h̘̻̟̠ ̘̮͔ou̙͕̗͡t ̲o̴̠̟̣̮͖̱̞r̞̞d̷͕̰͉̟̣e͕͇͕̗̲̖ͅr̗̥̪̪̘͠.͉̟̲̺̻͓͔͞
̘̥Ţ̜͙̞̖he҉ Ṉ̶͓̭̼ḛ̴̥͓̳̲z̤̜ͅp͔̩̱e͏͎r̜̙̪͚d҉͓̹͉͉̪̱i̹̹̻̣a͙͢n̼̞͉ ̖͔ḫ̨̝͈̹͓̺͚i͍̘͎̬̖v̩̫̻̭̤̺͍è̥̯̯̝-̯͚͕͟m̮͍͝i̲n͎̤͇͙̰͉d̜͍̝̭͇ ̲͟o̵͙͍̱̤f̲͕̪̟ ̥͎c͏̤̤̦̪h...
̠ͅH̵̪̥̠̼e̗͚̻̗̭̩̮ ͍͟w̷͙̭͙̙̝͙h̡̩͇̝̯o͏͉̱͉̲ͅ ̘͉͡W̠̲͙̰̹͡a͞i͍̼̝t̯̻̻̰̮̱̹s̗̭̖̦̠̺̥ ̙B̝͖̤͜e̘̫͍̤̩͇h̹i̖̦̼͓̠n̸͉̲d̨͚͓͎ͅ ͈͇̞̻̲̮̹͝T̸̝̜̠̜̞̤̜h̨̖̖è͈̞ͅ ̮W҉̞̹...
̤̝̦̠̬Z̤̺͉̦A̖͝L͍̱G̶̰̺̲̗̥̖̮O̩͈̠!̤̝̗
    	    
[credit to and shamelessly stolen from http://eemo.net] 

=head1 SEE ALSO

http://eeemo.net/ - Zalgo Text Generator

=head1 AUTHOR

Chuck Adams <cja987@gmail.com>

=head1 LICENSE

This module is Copyright 2014 Chuck Adams.

This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.



( run in 3.351 seconds using v1.01-cache-2.11-cpan-524268b4103 )