Mass Deface
Email Grabber
{$key} = $1 eq 'undef' ? undef : $1;
}
my $prevpos = 0;
sub FIRSTKEY {
$prevpos = 0;
substr($Config_SH_expanded, 1, index($Config_SH_expanded, '=') - 1 );
}
sub NEXTKEY {
my $pos = index($Config_SH_expanded, qq('\n), $prevpos) + 2;
my $len = index($Config_SH_expanded, "=", $pos) - $pos;
$prevpos = $pos;
$len > 0 ? substr($Config_SH_expanded, $pos, $len) : undef;
}
sub EXISTS {
return 1 if exists($_[0]->{$_[1]});
return(index($Config_SH_expanded, "\n$_[1]='") != -1
);
}
sub STORE { die "\%Config::Config is read-only\n" }
*DELETE = *CLEAR = \*STORE; # Typeglob aliasing uses less space
sub config_sh {
substr $Config_SH_expanded, 1, $config_sh_len;
}
sub config_re {
my $re = shift;
return map { chomp; $_ } grep eval{ /^(?:$re)=/ }, split /^/,
$Config_SH_expanded;
}
sub config_vars {
# implements -V:cfgvar option (see perlrun -V:)
foreach (@_) {
# find optional leading, trailing colons; and query-spec
my ($notag,$qry,$lncont) = m/^(:)?(.*?)(:)?$/; # flags fore and aft,
# map colon-flags to print decorations
my $prfx = $notag ? '': "$qry="; # tag-prefix for print
my $lnend = $lncont ? ' ' : ";\n"; # line ending for print
# all config-vars are by definition \w only, any \W means regex
if ($qry =~ /\W/) {
my @matches = config_re($qry);
print map "$_$lnend", @matches ? @matches : "$qry: not found" if !$notag;
print map { s/\w+=//; "$_$lnend" } @matches ? @matches : "$qry: not found" if $notag;
} else {
my $v = (exists $Config::Config{$qry}) ? $Config::Config{$qry}
: 'UNKNOWN';
$v = 'undef' unless defined $v;
print "${prfx}'${v}'$lnend";
}
}
}
# Called by the real AUTOLOAD
sub launcher {
undef &AUTOLOAD;
goto \&$Config::AUTOLOAD;
}
1;