Acme-ChuckNorris
view release on metacpan or search on metacpan
lib/Acme/ChuckNorris.pm view on Meta::CPAN
use warnings;
$Acme::ChuckNorris::VERSION = '0.3';
sub import {
no strict 'refs'; ## no critic
*{ caller() . '::round_house_kick_to_the_perl' } = \&round_house_kick_to_the_perl;
*{ caller() . '::round_house_kick_to_the_text' } = \&round_house_kick_to_the_text;
}
my %mostly_defaults = (
'Regex' => 1,
'Binary' => 0,
);
my %defaults_overridable = (
'Gap' => 1,
'InformHandler' => sub { },
'TrailingSpaces' => 1,
);
sub round_house_kick_to_the_text {
require Acme::EyeDrops;
return Acme::EyeDrops::sightly(
{
%defaults_overridable, # allow caller to override these in @_
@_[ 1 .. $#_ ],
( ref( $_[0] ) eq 'SCALAR' ? ( 'SourceString' => ${ $_[0] } ) : ref( $_[0] ) ? ( 'SourceHandle' => $_[0] ) : ( 'SourceFile' => $_[0] ) ),
'ShapeString' => join( '', <DATA> ),
'Shape' => undef,
%mostly_defaults, # not overridable
'Print' => 1,
}
);
}
sub round_house_kick_to_the_perl {
require Acme::EyeDrops;
return Acme::EyeDrops::sightly(
{
# allow caller to override the below options in @_
%defaults_overridable,
%mostly_defaults, # overridable
'TrapEvalDie' => 1,
'TrapWarn' => 1,
# allow caller to override the above options in @_
@_[ 1 .. $#_ ],
( ref( $_[0] ) eq 'SCALAR' ? ( 'SourceString' => ${ $_[0] } ) : ref( $_[0] ) ? ( 'SourceHandle' => $_[0] ) : ( 'SourceFile' => $_[0] ) ),
'ShapeString' => join( '', <DATA> ),
'Shape' => undef,
}
);
lib/Acme/ChuckNorris.pod view on Meta::CPAN
Turns your code into executable Chuck Norris perl.
my $chuck_norris_shaped_code = round_house_kick_to_the_perl(\q{print "Goodbye\n";die "You are now dead.\n";});
my $chuck_norris_shaped_code = round_house_kick_to_the_perl("/usr/bin/chuck_norris.pl");
Takes a scalar ref, file, of file handle that contains perl code.
Additional arguments could be any Acme::EyeDrops::sightly() option except SourceString, SourceFile, SourceHandle, or Shape (if you pass those they are ignored and you might get kicked in the face).
These Acme::EyeDrops::sightly() options are set by default and can be overridden:
'Gap' => 1,
'InformHandler' => sub { },
'TrailingSpaces' => 1,
'Regex' => 1,
'Binary' => 0,
'TrapEvalDie' => 1,
'TrapWarn' => 1,
requires L<Acme::EyeDrops>
lib/Acme/ChuckNorris.pod view on Meta::CPAN
Turns your text into executable Chuck Norris perl code that prints the original text.
my $chuck_norris_shaped_code = round_house_kick_to_the_text(\'Just Another Perl Hacker');
my $chuck_norris_shaped_code = round_house_kick_to_the_text(\'Chuck Norris can literally hack code with a machete');
Takes a scalar ref, file, of file handle that contains text.
Additional arguments could be any Acme::EyeDrops::sightly() option except SourceString, SourceFile, SourceHandle, Shape, Print, Regex, or Binary (if you pass those they are ignored and you might get kicked in the face).
These Acme::EyeDrops::sightly() options are set by default and can be overridden:
'Gap' => 1,
'InformHandler' => sub { },
'TrailingSpaces' => 1,
requires L<Acme::EyeDrops>
=head1 JAPH - Chuck Norris Style!
#!/usr/bin/perl -w
( run in 0.366 second using v1.01-cache-2.11-cpan-0a6323c29d9 )