View Single Post
  #1 (permalink)  
Old 12-26-03, 03:23 PM
VisualActive VisualActive is offline
Newbie Coder
 
Join Date: Dec 2003
Location: Planet Earth
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question OOP Programming Question

I'm still learning Object Oriented Programming but I have a question:

When I use the function br_queries and edit it so instead of print the value of
$IN{'act'}
you need to use
$IN->{'act'}

my only problem is that you get the absolute value of that variable with the %20 and all. When you use $IN{'act'} instead of $IN->{'act'} you don't get that.

here is the function/method:

sub br_queries
{
my ($string,%IN,@IN,$dat);

if ($ENV{'REQUEST_METHOD'} eq 'GET') { $string = $ENV{'QUERY_STRING'}; }
else { read(STDIN, $string, $ENV{'CONTENT_LENGTH'}); }

@IN = split(/&/, $string);
foreach (@IN)
{
split(/=/, $_);
$_[0] =~ s/\+/ /g;
$_[0] =~ s/\// /g;
$_[0] =~ s/\\/ /g;
$_[0] =~ s/%00//g;
$_[0] =~ s/%0a/newline/g;
$_[0] =~ s/(?:(\?)|&|[&;])s=[\w\d]{16,32}(?:&|&|;|$)//g;
$_[0] =~ s/%(..)/pack("c", hex($1))/ge;
if(defined($IN{$_[0]}))
{
$IN{$_[0]} .= "\0";
$IN{$_[0]} .= "$_[1]";
}
else
{
$IN{"$_[0]"} = $_[1];
}
}
foreach (keys %IN)
{
$IN{"$_"} =~ s/\+/ /g;
$IN{"$_"} =~ s/\// /g;
$IN{"$_"} =~ s/\\/ /g;
$IN{"$_"} =~ s/%00//g;
$IN{"$_"} =~ s/%0a/newline/g;
$IN{"$_"} =~ s/(?:(\?)|&|[&;])s=[\w\d]{16,32}(?:&|&|;|$)//g;
$IN{"$_"} =~ s/%(..)/pack("c", hex($1))/ge;
}

foreach (%IN)
{
$dat->{$_[0]} = $_[1];
}

return($dat);
}
Reply With Quote