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.

42CHAPTER 2 ■ POPULAR CGI MODULESFigure 2-3. An escaped string viewed through a web browserListing 2-5. Using uri_unescape <strong>to</strong> Make a String <strong>With</strong>out Escape Characters#!/usr/bin/perl -Tuse strict;use URI::Escape;use CGI qw/:standard/;my $unsafestring = "\$5/[3454]/this is a windows filename.asp";my $safestring = uri_escape($unsafestring);my $unescstring = uri_unescape($safestring);print header,start_html("Making URLs Safe Is Our Business"),p("The string that is unsafe for a URL is: $unsafestring\n"),p("When fed through the url_escape() function it becomes: $safestring\n"),p("When the escaped string is unescaped, it becomes: $unescstring\n"),end_html;exit;

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

Saved successfully!

Ooh no, something went wrong!