F.8. An Extended Example

Hopefully, you now have a general overview of the main features of Embperl. For more information—for example, to learn more about the many options you have in configuring Embperl or for instructions on how to configure Apache or mod_perl —please take a look at the Embperl web site at http://perl.apache.org/embperl/. Embperl is actively supported and development is going on all of the time. The web site will always contain information on the newest features.

Example 6.2 shows one last example of how you can use Embperl. It's a rewritten version of the hangman game of Chapter 5. Instead of creating its own session management, as in Chapter 5, this hangman game uses the Embperl built-in capabilities.

Example F.2. Hangman with Embperl
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <HTML><HEAD><TITLE>Hangman with Embperl</TITLE></HEAD> <BODY BGCOLOR="white" ONLOAD="if (document.gf) document.gf.guess.focus()"> <H1>Hangman with Embperl</H1> <P> This is an Embperl version of the Hangman game from <A HREF=http://www.modperl.com/>Writing Apache Modules with Perl and C<A> Chapter 5 </P> <HR> [! use constant WORDS => 'hangman-words'; use constant ICONS => '../images'; use constant TRIES => 6; use constant TOP_COUNT => 15; # how many top scores to show ########### subroutines ############## # This subroutines are just the same as in the hangman6.pl from chapter 5 # This is called to process the user's guess sub process_guess { my ($guess,$state) = @_; # lose immediately ...

Get Writing Apache Modules with Perl and C 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.