1. Perl
  2. Book Guide

[Book Guide] Easy Programming CGI/Perl by Yuki Kimoto

This is the CGI/Perl version of the book released as the "Easy Programming" series by Gijutsu-Hyoronsha.

[asin: 4774139289:detail]

This book seems to be the only CGI book written in modern Perl at this time. Most Perl books about CGI contain a lot of less recommended descriptions from the time Perl 4 was all the rage.

It seems unlikely that CGI books are written with modern Perl in mind.

The explanation of CGI is not about the details of the protocol, but it is an explanation that makes it easy to imagine what will be done internally when developing a Web application using the CGI protocol. ..

The explanation is such that you can understand the flow of "browser->HTTP request issuance->web server->CGI script->HTTP response generation->web server->browser".

CGI itself is no longer mainstream because it's slow, but I think it's useful as a help in understanding how web applications work.

It also explains in detail the part where CGI is placed and actually executed on Sakura's rental server. The explanations such as FFFTP are also polite, and when actually deploying CGI on the server, consideration is given to avoid tripping as much as possible.

This book contains a pure "Introduction to Perl" with rounded chapters. This chapter has nothing to do with CGI scripts, so you can read it as an introduction to modern Perl. The second chapter of Perl, which is useful for business, explains the basics of Perl, but I think it would be easier to imagine if you think that this is explained carefully.

Also, download the example code used in this manual from the Web. You can also try it.

Since this is my first work, there are quite a few typos and many typographical errors.

Challenge the web framework

The technique of writing web applications with CGI scripts is now obsolete. Let's challenge a web application using a web framework.

Easy programming I rewrote the web application example published in CGI/Perl with a framework called Mojolicious.

Easy programming CGI/Perl errata

We have created an errata for "Easy Programming CGI/Perl". It describes what you discovered and what you were told. It contains a lot of mistakes. I think most of the example code works.

|

page place Wrong Positive
P18 Lower row UTF-8 is changed to utf-8 in the explanation of Accept-Charset UTF-8 is correct
P24 Middle row "The data of the message body sent by the POST method is ..." is entered in duplicate. Remove duplication
P31 Upper row By default, "I Accept…" is checked. By default, "I Accespt…" is not checked
P34 Upper row Web applications are composed of four elements, "HTML", "HTTP", "CGI", and "Perl", and knowledge of each is indispensable. Web applications are made up of multiple technologies that require you to learn about "HTML, " "HTTP, " "CGI, " and "Perl."
P34 Middle row HTTP is not written like a CGI script, but the information described can be used in the script. The HTTP request header information can be used in the CGI script.
P34 Lower row The method of passing data from the web server to the CGI script is called "standard input", and the method of passing data from the CGI script to the web server is called "standard output". Use "standard input" to pass data from the web server to the CGI script, and use "standard output" to pass data from the CGI script to the web server.
P59 Middle row The position of "8. The description of Perl execution path is incorrect" is different. The position immediately after "7. CGI script permissions" on page 056 is correct.
P62 Upper row Display on screen Display on screen
P64 Middle row Includes Unix extended OS and Linux OS Includes Unix-extended OS and Linux-based OS
P74 Upper row Unlike the inequality sign, "=" does not mean "equal to". Unlike the equal sign in mathematics, "=" does not mean "equal to".
P75 Upper row Use a name that makes sense. Use a name that makes sense.
P79 Lower row There is a weird sign called l < Forgotten to delete
P83 Middle row The position of "You can access the elements of the array using subscripts." Is incorrect. Immediately after "Array elements" in the middle heading is correct.
P84 Middle row Assigning an a array variable to a scalar variable in this way is called a scalar context. This sentence is correct to remove because the description is incorrect.
P86 Middle row Middle heading "Add an array to an array" "Add multiple elements to the array" is correct
P86 Middle row It supports not only one element but also the addition of arrays It supports not only one element but also multiple elements
P87 Middle row Source code @nums = reverse sort {$b <=> $a} @nums I don't need reverse. @nums = sort {$b <=> $a} @nums is correct.
P88 Middle row Source code ($name, $age) = ('Ken', 'Taro') ($name, $age) = ('Ken', 18) is correct
P85 Upper row There is no closing brace in the if part of the source code Add closing brace
P86 Lower row This is an example of extracting the first and second elements of an array. This is an example of extracting two elements from the second element of the array (1 with a subscript).
P87 Upper row This is an example of replacing two elements from the first position of an element in the array. This is an example of replacing two elements from the second element of the array (1 with a subscript).
P89 Lower row "Print $animal_join;" is missing at the end of the source code Added print $animal_join;
P089 Lower row I'm using join even though I haven't explained about join. It is explained in Chapter 3, Section 5, "Numerical Arithmetic and String Manipulation".
P89 Middle row Source code line 18 my $last_animals = pos; my $last_animals = pop @animals is correct
P102 Upper row Returns the character number from which the position starts Returns that position as a return value
P091 Lower row After international standard International standard language
P105 Lower row There is garbage called> ll. It is correct to remove.
P108 14th line from the top Logical sum (what and what) OR (what or what)
P110 Lower row How to execute the script is missing Let's run the script with arguments. It is correct to add perl example_3_6 1 2
P111 7th line from the top "0" is in the first element "1" is the first element
P111 3rd line from the bottom $num[0] $num[1] $nums[0] $nums[1]
P114 Lower row If "$animal" is "cat" If "$animal" is "dog"
P123 Upper row samplw_3_8.pl example_3_8.pl
P145 Upper row close $fh close $fh;
P148 Upper row It's a little advanced topic, but you should definitely know it. It's a little advanced topic, but there are some things you should know.
P157 Middle row windwos perl nmake windows perl nmake
P158 Middle row Let's make it complete Let's keep it concise
P158 Upper row Perl scripts are run from Perl commands, specifying the directory where the script resides from a command prompt or shell, not from a web browser. Perl scripts are executed using perl commands from a command prompt, shell, etc.
P158 Upper row A variable is a mechanism that can store a value. The value can be maintained until the program ends and can be used repeatedly. It is correct to modify it to "Variable can be assigned values." Variable don't hold their value until the end of the program.
P162 Middle row There is no slash (/) in the closing tag of the title tag. It is correct to have a slash.
P164 Middle row There is no slash (/) in the closing tag of the title tag. It is correct to have a slash.
P165 Middle row There is no slash (/) in the closing tag of the title tag. It is correct to have a slash.
P167 Middle row There is no slash (/) in the closing tag of the title tag. It is correct to have a slash.
P170 Middle row There is no slash (/) in the closing tag of the title tag. It is correct to have a slash.
P173 Middle row The URL of the action of the form is specified incorrectly. /cgi-bin/simple-form.cgi is correct.
P174 Upper row

/var/www/htm

/var/www/html

P176 Lower row The received string was output. The received string is output.
P207 Upper row No source code name image-bbs.cgi
P232 Upper row The heading "The data to be output is always ..." is the middle heading. The subheading is correct
P234 Upper row Is there a module that plays the role of the executed program? Is there a module that plays the role of the program you want to execute?
P235 Lower row Embed tara in the source code? "Embed taro in the? Part" is correct.

Related Informatrion