So I took a spoonful of Acme::Bleach, a pinch of Exporter and here's what I got.
once cluttered (i.e. run once) becomes:use My::Acme::Clutter qq[( test => 45, foo => 'bar')];
use My::Acme::Clutter '`282074657374203d3e2034352c20666f6f203d3e202762 +61722729';
It's a very simple encrypt/decrypt, but meets our level of "difficult". I need to add some error checks. And I'd like to use Exporter, but I couldn't get export_to_level to work :?
Besides that, all opinions desired!
--Solopackage My::Acme::Clutter; use 5.006; sub encrypt { my $return; for ( split(//,shift) ) { $return .= sprintf("%02x",ord($_)); } return $return; } sub decrypt { my $return; for ( $_[0] =~ /.{2}/g ) { $return .= chr( hex $_ ); } return $return; } sub import { my $pkg = shift; my $callpkg = (caller)[0]; my $string = shift; if ($string =~ s/^`//) { $string = decrypt($string); } else { my $clutter = encrypt($string); open 0 or print "Can't clutter '$0'\n"; (my $file = join "", <0>) =~ s{^\s*use\s+My::Acme::Clutter.*?;\n}{use My::Acme::Clutter ' +`$clutter';}m; open 0, ">$0" or print "Cannot clutter '$0'\n" and exit; print {0} $file and exit; } # turn the string into a hash my %args = eval $string; # finally, do the import; for my $var (keys %args) { ${"${callpkg}::$var"} = $args{$var}; } } 1;
--
There's no mystical energy field that controls my destiny. It's all a lot of simple tricks and nonsense.
In reply to Embed passwords (Acme::Clutter idea) by Solo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |