Chapter 7. JavaScript
Looking at the title of this chapter, you probably said to yourself, “JavaScript? What does that have to do with CGI programming or Perl?” It’s true that JavaScript is not Perl, and it cannot be used to write CGI scripts.[9] However, in order to develop powerful web applications we need to learn much more than CGI itself. Therefore, our discussion has already covered HTTP and HTML forms and will later cover email and SQL. JavaScript is yet another tool that, although not fundamental to creating CGI scripts, can help us create better web applications.
In this chapter, we will focus on three specific applications of JavaScript: validating user input in forms; generating semiautonomous clients; and bookmarklets. As we will soon see, all three of these examples use JavaScript on the client side but still rely on CGI scripts on the server side.
This chapter is not intended to be an introduction to JavaScript. Since many web developers learn HTML and JavaScript before turning to Perl and CGI, we will assume you’ve had some exposure to JavaScript already. If you haven’t, or if you are interested in learning more, you may wish to refer to JavaScript: The Definitive Guide by David Flanagan (O’Reilly & Associates, Inc.).
Background
Before we get started, let’s discuss the background of JavaScript. As we said, we’ll skip the introduction to JavaScript programming, but we should clear up possible confusions about what we mean when we refer to JavaScript and how JavaScript ...
Get CGI Programming with Perl, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.