You are previewing Web, Graphics & Perl/Tk Programming.
O'Reilly logo
Web, Graphics & Perl/Tk Programming

Book Description

Web, Graphics & Perl/Tk is the second volume of The Best of the Perl Journal, compiled and re-edited by the original editor and publisher of The Perl Journal, Jon Orwant. In this series, we've taken the very best (and still relevant) articles published in TPJ over its five years of publication and immortalized them into three volumes.

Written by twenty-three of the most prominent and prolific members of the closely-knit Perl community, including Lincoln Stein, Mark-Jason Dominus, Alligator Descartes, and Dan Brian, the forty articles included in this volume are simply some of the best Perl articles ever written on the subjects of graphics, the Web, and Perl/Tk.

Table of Contents

  1. Web, Graphics, and Perl/Tk: Best of the Perl Journal
  2. A Note Regarding Supplemental Files
  3. Preface
    1. Finding Perl Resources
    2. Conventions Used in This Book
    3. Comments and Questions
    4. Acknowledgments
  4. 1. Introduction
  5. I. Web
    1. 2. CGI Programming
      1. CGI Programming Without CGI.pm
      2. The CGI.pm Module
    2. 3. Saving CGI State
      1. State in CGI Scripts
      2. A Sample State-Maintaining CGI Script
    3. 4. Cookies
      1. Creating Cookies
      2. Retrieving Cookies
      3. A Sample Cookie Program
    4. 5. mod_perl
      1. Transaction Handlers
      2. A Typical Content Handler
      3. Apache::Registry
      4. A Typical Non-Content Handler
      5. Getting Fancy: A Stately Script
      6. Impaled by the Fork
      7. Other mod_perl Features
    5. 6. Creating mod_perl Applications
      1. So, What Is This mod_perl Thing, Anyhow?
      2. Developing with mod_perl
      3. Apache::Registry
      4. Embperl
      5. Writing Your Own Handler
      6. Performance
        1. Preload Your Modules
        2. Use Multiple Servers
      7. Our Sample Application
      8. Components
      9. DBI and Apache::DBI
      10. Apache::AuthDBI
      11. Apache::Sandwich
      12. Writing the Application Code
        1. Database Setup
        2. TopTenTrans.pm
        3. index.epl
        4. rateit
        5. ttadmin
      13. Putting It All Together
        1. httpd.conf
    6. 7. Proxying with mod_perl
      1. Why Proxy?
      2. How the Proxy Protocol Works
      3. Identifying Ads
    7. 8. Authentication with mod_perl
      1. Access Control
      2. Authentication
        1. Windows Domain Server Authentication
        2. More NT Authentication
      3. Authorization
        1. Basic Authorization
        2. More Sophisticated Authorization
      4. Conclusion
    8. 9. Navigation Bars with mod_perl
      1. The Configuration File
      2. Activating the Navigation Bar
      3. Generating the Navigation Bar
      4. A Foundation to Build On
    9. 10. Scripting the Web with LWP
    10. 11. Five Quick Hacks: Downloading web Pages
      1. Downloading Currency Exchange Rates
      2. Downloading Weather Information
      3. Downloading News Stories
      4. Completing U.S. Postal Addresses
      5. Downloading Stock Quotes
      6. Conclusion
      7. Afterword
    11. 12. Downloading Web Pages Through a Proxy Server
      1. Afterword
    12. 13. HTML::Parser
      1. Getting Started
      2. The Identity Parser
      3. The HTML Tag Stripper
      4. Another Example: HTML Summaries
      5. Another Fictional Example
      6. Using HTML::Parser Version 3
      7. Acknowledgments
    13. 14. Scanning HTML
      1. HTML::Parser, HTML::TreeBuilder, and HTML::Element
      2. Scanning HTML Trees
      3. Complex Criteria in Tree Scanning
      4. A Case Study: Scanning Yahoo! News
      5. Regardez, Duvet!
    14. 15. A Web Spider in One Line
      1. Callbacks and Closures
      2. Cascading Arrows
      3. Using Modules with One-Liners
      4. The End
    15. 16. Webpluck
      1. Similar Tools
      2. How to Use webpluck
      3. How webpluck Works
      4. The Dark Side of the Force
        1. Identify Yourself
        2. Don’t Overload a Site
        3. Obey Robot Exclusion Rules
    16. 17. Torture-Testing Web Servers and CGI Scripts
      1. The Code
      2. Wrapping Up
    17. 18. Securing Your CGI Scripts
      1. The Example Script
      2. Designing the Script
      3. The chat2.pl Library
      4. Oops
      5. The CGI Script
      6. The Rest of the Script
      7. Caveats
    18. 19. Building Web Sites with Mason
      1. What Is Mason?
        1. SSI Redux
        2. Form Versus Function
      2. Installation
      3. Building a Dynamic Site
        1. Headers and Footers
        2. Passing Parameters
        3. Default Handlers and XML
        4. Accessing MySQL
      4. What Now?
    19. 20. Surreal HTML
      1. How It Works
      2. Prompting the User
      3. Fetching the Document
      4. Running the Travesty Algorithm
      5. Printing the Mangled Document
    20. 21. Web Page Tastefulness
      1. How It Works
      2. The <BASE> Tag
      3. For Extra Credit
    21. 22. Summarizing Web Pages with HTML::Summary
      1. CS-Web: A Search Engine for Canon’s Web Space
      2. META Tags
      3. Basic Summarization Methods
      4. HTML::Summary
      5. The Summarization Algorithm
      6. Sentence Splitting
      7. Conclusion
      8. Afterword: Truncating Japanese Text
    22. 23. Wireless Surfing with WAP and WML
      1. A Quick Look at WAP
      2. Enabling WAP on Apache
      3. WML Basics
      4. WAP Cards
      5. Developing WAP Applications
      6. CGI::WML
      7. A Small File Browser with CGI::WML and mod_perl
      8. Generating WML with HTML::Mason
      9. A WML Phone Directory with Mason
      10. WML with Straight Perl
      11. A Remote Control for Home Automation
      12. Creating a Personal Portal
  6. II. Graphics
    1. 24. Web Plots with Gnuplot
      1. Using Gnuplot
      2. Parsing Log Files
      3. Putting It All Together
      4. Simple Things Made Easy
    2. 25. GD-Graph3d
      1. Using GD-Graph3d
      2. What the Future Holds
      3. Installing GD
    3. 26. GD and L-Systems
      1. GD
      2. L-Systems
      3. Turtles
      4. A Turtle Draws a Tree
      5. Putting L-Systems to Work
      6. Leaves
      7. Flowers
      8. Bringing It All Together
      9. Resources
    4. 27. OpenGL
      1. Back to Basics
      2. Graphical Primitives
        1. The Vertex
        2. The Line
        3. The Polygon
      3. Drawing on the Screen
        1. The Viewport
        2. The View Frustum
        3. Perspective
        4. Rendering Pipelines
      4. Introduction to OpenGL
      5. OpenGL and Perl
        1. Creating a Viewport
        2. Creating the View Frustum
      6. Drawing Objects
        1. Some Viewport Tricks
        2. Viewport Resize Issues
      7. Resources
      8. References
      9. Acknowledgments
    5. 28. Ray Tracing
      1. Technique
      2. Make It Faster
      3. Mathematics
      4. The Program
      5. The Input
      6. The Output
      7. Internals
      8. Other Directions
    6. 29. Perl and the Gimp
      1. Using the Gimp
      2. Getting the Tools
      3. Using the Gimp Module
      4. Moving On
    7. 30. Glade
      1. GTK+/Gnome
      2. Perl and GTK+/Gnome
      3. Glade
      4. Installation
      5. Designing an Interface
      6. Adding Code
      7. Saving and Building the Project
      8. Writing the Signal Handler Code
      9. Inheritance as a GUI Development Tool
      10. Further Exploration
      11. More Information
    8. 31. Gnome Panel Applets
      1. Gnome
      2. Program Overview
      3. Initialization
      4. The Callbacks
      5. Conclusion
      6. Afterword
    9. 32. Capturing Video in Real Time
      1. Video::Capture::V4l
      2. Part I: Video Capturing
      3. Capturing Frames in a Loop
      4. Channels, Tuners, and Audio and Picture Settings
      5. Magic Constants for Frequencies?
      6. Example: Image Sequence Detection
      7. Example: Real Time Video Capturing
      8. Part II: The Vertical Blanking Interval
      9. Standards
      10. Decoding VPS
      11. The Autotune Script
      12. Decoding Videotext
      13. References
  7. III. Perl/Tk
    1. 33. A Perl/Tk Roadmap
      1. Understand the Basics
      2. Ignore What You Don’t Need
    2. 34. Getting Started with Perl/Tk
      1. Perl/Tk Programming
      2. A Sample Perl/Tk Program: plop
      3. Improving plop
    3. 35. Scoreboard: A 15-Minute Perl/Tk Application
      1. The Need
      2. The Design
      3. The Implementation
    4. 36. The Mouse Odometer
      1. Measuring Distance
      2. Menus
      3. The ColorEditor Widget
      4. Composite Widgets
    5. 37. Events
      1. Timer Events
      2. I/O Events
      3. Idle Events
      4. Pong
      5. Miscellaneous Event Commands
    6. 38. The Pack and Grid Geometry Managers
      1. A Brief Look at the Packer
      2. The Gridder
    7. 39. Drawing on a Canvas
      1. Our Mower Is Programmable!
      2. A Canvas Widget Is the Lawn
      3. Defining the Perl Mowing Module
      4. Zero Turning Radius, Take One
      5. The Canvas Line Item Type
      6. Zero Turning Radius, Take Two
      7. Rotating Simple Objects in Canvas Space
      8. The Canvas Rectangle and Text Item Types
      9. The Canvas Arc Item Type
      10. Nonzero Turning Radius, Take One
      11. Canvas Tags
      12. Scaling Canvas Items
      13. The Real World Is Uncertain
    8. 40. Displaying Databases with the Tree Widget
      1. Using Databases from Perl
      2. Overview of the tkdb Application
      3. Building the Graphical Interface
      4. Creating a Tree View of a Database
      5. Making Changes to a Database
      6. The Tk::Error Subroutine
    9. Index
  8. Colophon
  9. Copyright