10.07.2015 Views

Beginning Web Development With Perl : From Novice to ... - Nabo

Beginning Web Development With Perl : From Novice to ... - Nabo

Beginning Web Development With Perl : From Novice to ... - Nabo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

214CHAPTER 11 ■ DEVELOPMENT WITH MOD_PERLFigure 11-9. Another way <strong>to</strong> produce output from the args() methodYet another way <strong>to</strong> accomplish the task at hand is <strong>to</strong> place the output from the args() methodin<strong>to</strong> a hash, and then iterate through the hash, as shown in Listing 11-6 (Printquery3.cgi).Listing 11-6. Iterating Through the Argumentsuse strict;my $r = shift;$r->send_http_header('text/plain');my %args = $r->args;foreach my $arg (keys %args) {print "$arg = $args{$arg}\n";}This example has the effect of producing traditional name=value pairs that are easier <strong>to</strong>work with inside the program. This cleaner output is shown in Figure 11-10.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!