Perl Assignment #12:
Strings and Sorting
Smart Match and given-when
CS 447/647
Spring, 2012
Due:
4/24/12
Read
chapter 14 of Learning Perl. Do exercises 1 and 2
Read
chapter 15 of Learning Perl. Do exercise 2
Submit
assign12.txt via Web Campus.
Hands-On
Exercise
Web
server Configuration
1.
Install Apache and
MySQL
# apt-get install apache2 mysql-server
phpMyAdmin
(to
preserve sanity use the same password for everything below)
Enter the new MySQL
password and verify it
Select automatic
reconfigure for apache2
Select configure
phpMyAdmin with dbcommon-conf
Enter the MySQL password
from above
Enter the new phpMyAdmin
password and verify it
2. Test the
default webpage
In a web browser and
connect to:
Verify you see the It
Works! page
Create an on-line store:
3. Connect to
MySQL using phpMyAdmin and create a new
database and table and populate it with 2 records
In a web browser and
connect to: http://localhost/phpmyadmin
Login as root with the phpMyAdmin password from above
Create a new database
called Amazon
Create a new table called Products with 1 field
Create the new field with
the following properties:
Field: ASIN
Type: VarChar
Length: 10
Index: Primary
Take the
defaults for everything else
Click Save
Click the Insert tab
Insert 2 rows with the
following ASINs:
0596520107
0131480057
Select the Insert a new row drop-down before
clicking Go
After entering the second
row click the Browse tab to make
sure both rows are there
Click the Exit icon to logout from phpMyAdmin
4. Perl script
to create the web pages
wget http://www.cse.unr.edu/~dahl/create-pages.txt
mv
create-pages.{txt,pl}
# Update the MySQLpwd using your password from step 1 above
vi create-pages.pl
sudo bash
perl create-pages.pl
# You
should see two new pages in /var/www:
#
ls /var/www
0131480057.html 0596520107.html
5. View the
pages in your web browser
http://localhost/0131480057.html
http://localhost/0596520107.html
6. Create a
script session and submit it on Web Campus
script handson12.txt
cd /tmp
wget http://localhost/0131480057.html
cat 0131480057.html
ping www.colorado.edu
sudo apt-get
install traceroute
traceroute
www.colorado.edu
exit
7. For more
info on Amazon Associates:
https://affiliate-program.amazon.com/